I'm creating an owner-drawn control (inherited from Control) which is
scrollable, and I'm using standard scroll bars for that aspect (i.e., my
control is owner drawn except for the scroll bars, and yes, I know, I could
have used ScrollableControl). I want to implement "thumbnail panning"
functionality, by which I mean the user can click in the little square
formed where the two scrollbars meet and a thumbnail window pops up
representing the entire control, and the user can move the mouse around in
this thumbnail to select the portion of the surface that is to be displayed
in the main viewport. (What a mouthful.) This functionality can be found in
the SSIS designer, the Windows Workflow designer, and probably lots of other
programs that have drawing surfaces which are often larger than what is
visible.
The design issue I'm bringing up is the transfer of mouse capture from one
window to another. If it weren't for the scroll bars I'd simply draw my pan
window and worry about mouse movement in my main control. However, since the
scroll bars are child controls they're higher in the z-order and I won't be
able to draw over them. Therefore I'm assuming I need to popup up a
separate, borderless form to serve as the thumbnail. Not a problem, but I
want this form to immediately take over the mouse. In other words, once the
mouse goes down on the main control it needs to stay down; releasing the
mouse button is the signal that the user has selected the desired viewport
and it's time to dismiss the pan window. Since my main control will have
mouse capture, how do I send it to the pan window?
Michael C - 18 Mar 2008 03:25 GMT
> I'm creating an owner-drawn control (inherited from Control) which is
> scrollable, and I'm using standard scroll bars for that aspect (i.e., my
[quoted text clipped - 20 lines]
> desired viewport and it's time to dismiss the pan window. Since my main
> control will have mouse capture, how do I send it to the pan window?
Hi Jeff, I don't think you need to use a form. Just create a frame control
and show it when required. You can then draw to the frame while it is
visible. The other option is to create a second usercontrol and show that.
This will be a good option as you can encapsulate the required functionality
into that control. Either method will have the ability to go over the
scrollbars.
However, if you wanted the popup to go outside the original control's area
then you would need to use a form. To have that form grab the mouse input I
believe you can just set this.Capture = true.
Regards,
Michael
Jeff Johnson - 18 Mar 2008 06:42 GMT
> Hi Jeff, I don't think you need to use a form. Just create a frame control
> and show it when required. You can then draw to the frame while it is
> visible. The other option is to create a second usercontrol and show that.
> This will be a good option as you can encapsulate the required
> functionality into that control. Either method will have the ability to go
> over the scrollbars.
You're right; I didn't think of simply creating another control and bringing
it to the top.