Drawing Lines On A Label

Why such big text?
You create a Graphics object from the label, as in
GFX = yourlabel.CreateGraphics()
And then, you draw it, like
GFX.DrawLine(0, 0, yourlabel.width, yourlabel.height)
Draws a line going from the top left to the bottom right of the label. :)
 
Thanks

Sorry about the big text ... I was experimenting ...
Thank You for your advice ...
Iceplug said:
Why such big text?
You create a Graphics object from the label, as in
GFX = yourlabel.CreateGraphics()
And then, you draw it, like
GFX.DrawLine(0, 0, yourlabel.width, yourlabel.height)
Draws a line going from the top left to the bottom right of the label. :)
 
Graphics Question

Works great iceplug! Just tried it, never worked with graphics before... One question though, after I draw the line or fill a new backround, how do I return the label to its original state?
 
You can:
DIspose the graphics object
or use an If statement to NOT draw the line ... for example
If IwantToDrawTheLine Then
e.graphics.drawline(......)
End If

jtstantish - also you can go in to the labels Paint event and draw the line:
e.graphics.DrawLine(.....)

and use Label1.Invalidate if the position of the line ever changes and you want to update it.

-The Pentium Guy
 
Back
Top