Carl Franklin

.NET Wonk

Rubberbanding in Windows Forms

It's been a while since I posted any code, so I thought I'd send a little something out. This is a good example of visual inheritance. I created a new Windows form class based on System.Windows.Forms.Form, and added the ability to let the user select a rectangle ala rubberbanding. Set the AllowSelect property to True. When the user selects a rectangle and releases the mouse, the RectangleSelected event is raised, passing the rectangle relative to the form. A simple demo program (included) shows how to use this form to let the user draw buttons. The buttons are named and wired up to a Click event handler on the fly.

Download the source (55K) at http://www.franklins.net/dotnet

 

 

Comments

krishnadutt said:

your suggested link does not work

# May 10, 2009 1:55 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)