Results 1 to 3 of 3

Thread: Drawing a line OVER other controls on a form.

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2002
    Location
    Brisbane, Australia
    Posts
    11

    Drawing a line OVER other controls on a form.

    I need to draw a line on a form, but it needs to be able to draw on top of other controls on the form.

    Drawing a line on a form is no problem, eg.
    Code:
    Dim p As New Pen(Color.Red, 3)
    Form1.CreateGraphics.Clear(Color.Gray)
    Form1.CreateGraphics.DrawLine(p, 0, 0, 100, 100)
    but this just draws the line on the form's background and any controls on the form get drawn on top of the line, thereby breaking the line.

    What I need could be accomplished by creating a usercontrol 'Line', but this seems like a lot of overhead for a simple line. There has got to be a better way doesn't there?

    Eamon

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    If you want to draw on the form then you wont be able to see it on the other controls. you could draw a portion of the line in every single control, but I dont think you want to do that
    Making a user control as you said would be the best idea, IMHO. I dont think you would be able to "draw" it on other controls the way you want to

  3. #3
    Fanatic Member
    Join Date
    Jun 2001
    Posts
    521
    If VB.NET forms still have the clipcontrols property, play around with that... If worse comes to worse, you can subclass the form.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width