Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Drawing overlays over button controls

Drawing overlays over button controls

Scheduled Pinned Locked Moved Graphics
graphicscsharpquestion
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JVilmaire
    wrote on last edited by
    #1

    I posted this in the C# forum and then saw this forum on Graphics..(probably is better placed here, please excuse the double post) I'm trying to draw lines that will show up as overlays on top of the buttons that I am drawing. The buttons are just standard buttons with images on them, but they occlude the lines when I draw the lines in the Form on paint method. Is there a way to paint the lines after the buttons have been drawn, in order to make the lines visible on top of the buttons? I thought of a transparent form overlayed that I could draw to, but I thought that this would stop me from interfacing with the buttons. Any Ideas? James

    I 1 Reply Last reply
    0
    • J JVilmaire

      I posted this in the C# forum and then saw this forum on Graphics..(probably is better placed here, please excuse the double post) I'm trying to draw lines that will show up as overlays on top of the buttons that I am drawing. The buttons are just standard buttons with images on them, but they occlude the lines when I draw the lines in the Form on paint method. Is there a way to paint the lines after the buttons have been drawn, in order to make the lines visible on top of the buttons? I thought of a transparent form overlayed that I could draw to, but I thought that this would stop me from interfacing with the buttons. Any Ideas? James

      I Offline
      I Offline
      Ian Shlasko
      wrote on last edited by
      #2

      Painting on the form doesn't work, because all form drawing takes place on a layer behind the controls. I see two possible solutions, depending on what you're trying to accomplish... 1) If you just need to draw something on the button itself, try subclassing the button and inserting your own OnPaint code (After a base.OnPaint call) 2) If you're drawing on both the form -and- the button, like an arrow pointing to the control, your transparent form idea might work. It might take some tweaking, but you can override the WndProc method to pass the WM_NCHITTEST message (I think that's the one), always returning the value for Nothing (I think the constant is called HTNOTHING). Windows calls this when the user tries to interact with something, to determine which process/thread/control should receive the event. This basically tells it that your form isn't really there, as far as input is concerned.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups