Groups | Blog | Home
all groups > dotnet drawing api > november 2003 >

dotnet drawing api : Drawing an erasable line?


John
11/30/2003 10:01:55 AM
Hi,

I want to write a control similar to the splitter control,
whereas when the user drags the control a line is drawn
which is then removed depending where the user has the
mouse. (rubber banding?)

Any help much appreciated?

Jay B. Harlow [MVP - Outlook]
11/30/2003 1:28:03 PM
John,
The easiest way to draw an "erasable line" is to use
ControlPaint.DrawReversibleLine.

Using DrawReversibleLine once displays the line, using it a second time with
the same points causes the line to disappear.

ControlPaint is in the System.Windows.Forms namespace.

Note: The points you pass to DrawReversibleLine are in screen coordinates,
not client coordinates.

There is also a ControlPaint.DrawReversibleFrame if you want to draw a box
instead of a straight line.

Hope this helps
Jay

[quoted text, click to view]

Alvin Bruney
11/30/2003 7:22:34 PM
Then just draw a line on mouse down and move and remove it on mouse up


[quoted text, click to view]

JHornick NO[at]SPAM online.microsoft.com
12/2/2003 6:03:39 PM
Hi,

[quoted text, click to view]


Jay pretty much already pointed this out in text, but just to
evangelize the KB a bit:

http://support.microsoft.com/?id=314945
http://support.microsoft.com/?id=317479

Thanks,
- John
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.
AddThis Social Bookmark Button