Quantcast
Viewing all articles
Browse latest Browse all 1449

Drag form by any "gray" space rather than just the title-bar

A special thanks to LaVolpe for coming up with the best idea on doing this.

Sure, most of us know how to drag a form around by the form's own "gray" space. But what if we also want labels to drag it, and we also want any containers to work as well. Sure, we don't want Buttons, TextBoxes, ComboBoxes, and other "active" controls to work, but we do want the inactive controls to work. That's where these routines come to the rescue.

Let me also say that this may not be a perfect solution for everyone, especially if you use labels and containers in a more "active" way than I do. But I thought it was pretty cool, so I posted it.

Also, just as an FYI, it also works with the SSTab container, which I tend to use often.

Start by looking at the code in Form1 to see how to use it. It should be fairly self-explanatory. The whole objective was to make the amount of code in your form be at a minimum. The other modules should just be "drop ins" for you.

Sure, we could do this by monitoring the mouse-events of all the places we'd like to drag, but these procedures hopefully makes the whole thing easier. Also, my objective was to do all of this without sub-classing so we could still use all the glory of the IDE. Labels in control arrays don't slow it down either.

Enjoy,
Elroy
Attached Files

Viewing all articles
Browse latest Browse all 1449

Trending Articles