We need to know which edge of a UserControl is being stretched when in
design mode. We've created our own CustomControlDesigner, derived from
ControlDesigner for our UserControl. We can't find a way to determine
which edge of the Designer/Control is being stretched when the control
is being resized in design mode. We want to resize different fields
within the UserControl, based on the edge being dragged.

There does not appear to be a way to get a mouse-down event before the
resize to see which edge the user is being dragged. Any Ideas? Thanks

Re: Siziing UserControls via a custom ControlDesigner by Bob

Bob
Wed Jul 13 09:59:09 CDT 2005

You need to have the designer add a handler to the target controls
onsizechanged event and deduce the change.

Ideally, you should not be putting any design time functionality into the
control itself.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"dei" <dei1@eieioh.net> wrote in message
news:1121261918.752093.260260@f14g2000cwb.googlegroups.com...
> We need to know which edge of a UserControl is being stretched when in
> design mode. We've created our own CustomControlDesigner, derived from
> ControlDesigner for our UserControl. We can't find a way to determine
> which edge of the Designer/Control is being stretched when the control
> is being resized in design mode. We want to resize different fields
> within the UserControl, based on the edge being dragged.
>
> There does not appear to be a way to get a mouse-down event before the
> resize to see which edge the user is being dragged. Any Ideas? Thanks
>



Re: Siziing UserControls via a custom ControlDesigner by dei

dei
Thu Jul 14 07:55:58 CDT 2005

How do you deduce which corner or edge of the control was dragged from
the control's OnSizeChanged event? We were trying to hook the
mouse-down event to deduce the edge being dragged.


Re: Siziing UserControls via a custom ControlDesigner by dei

dei
Thu Jul 14 08:12:30 CDT 2005

How do you deduce which corner or edge of the control was dragged from
the control's OnSizeChanged event? We were trying to hook the
mouse-down event to deduce the edge being dragged.

When you drag the left edge of a control, you get a LocationChanged
event that moves the left edge of the control to your "drop location"
while keeping the size of the control the same. This is followed by a
SizeChanged event that adjusts the width of the control to give it your
new size. How do you differentiate this sequence form a user generated
move of the control followed by a right edge drag of the control?


Re: Siziing UserControls via a custom ControlDesigner by Bob

Bob
Thu Jul 14 11:43:48 CDT 2005

In the designer we keep the previous positions of the bits we're interested
in in screen coordinates and do a comparison. This enables us to resize some
control points other than those on the grab-handles.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"dei" <dei1@eieioh.net> wrote in message
news:1121346750.225066.47240@o13g2000cwo.googlegroups.com...
> How do you deduce which corner or edge of the control was dragged from
> the control's OnSizeChanged event? We were trying to hook the
> mouse-down event to deduce the edge being dragged.
>
> When you drag the left edge of a control, you get a LocationChanged
> event that moves the left edge of the control to your "drop location"
> while keeping the size of the control the same. This is followed by a
> SizeChanged event that adjusts the width of the control to give it your
> new size. How do you differentiate this sequence form a user generated
> move of the control followed by a right edge drag of the control?
>