views:

183

answers:

1

I'm looking for drag/size handle implementations or explanations.

Perhaps I'm using the wrong nomenclature, but I mean the "handles" that appear around an object (mostly in drawing programs) when you select it and want to perform an operation on that object such as rotate, size, scale, etc...

Can anyone point me to an OSS implementation I can look at or explain how they have/would implement this?

A: 

In windows this really isn't an OS feature... it's something you code yourself.

Basically you create an array of rectangles where the handles are to appear. You're goal here is twofold, the first is for simply drawing the handles, the second is for passing to a PointInRectangle call.

The "PointInRectangle" call bit is done during MouseMove events. Basically this is where you decide based on the current mouse location what cursor the mouse should have (aka what "mode" the mouse is in).

The other tricky bits are handling mouse down and determining if its time to start dragging, mouse move while dragging, and mouse up for end of dragging.

All in all it can be a bunch of work. Oh.. and don't forget that you may need to scroll your drawing pane/window if dragging near the edges.

Depending on what you're doing you might want to take a look at http://www.lassalle.com/. They have a great inexpensive graph (not charting) tool.

Yes, thank you. I misspelled OSS (Open Source Software) as OS. Apologies.
FWIW - This is not a graphing tool.
What's the MONO development environment? Resharper? It has a form designer in it that uses handles.