Releasing mouses grip on edge of sizable form?

W

What-a-Tool

I have an mdichild form whose minimum size I want to limit (can't be dragged
below a certain size)
Even though I am running .NET 1.1 where the minimum size property supposedly
works, it's not working for my child forms.

Herfried K. Wagner directed me to a code sample which he wrote as a work
around for this problem.
Very interesting code. You're obviously light years ahead of me in
programing skills. Some day in the near future I plan on taking the time to
sit and check it out a bit more closely to try and undertand exactly what is
going on there. Right now though, I can't figure how to use it to get what I
want to happen. Thanks for the help though.

But for now-
Is it posible to get the mouse to release its grip on the edge of the form
as it's being dragged to a new size?
Have my form resize itself to my desired minimum size whenever it reaches my
min size, but the mouse retains its grip, enabling me to drag the form edge
around as small as I want. It always apears as my min size, but this just
causes it to flicker like crazy until you finally release the mouse button.
Can I force this release when my desired size is reached?

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
A

Andrew \(Infragistics\)

You want it to stop all sizing (including when the mouse is dragged back to
the right to make it larger)? If so, you could send the window a
WM_CANCELMODE message; normally you do this with the SendMessage api but you
could just override the OnSizeChanged method of the form and call the
WndProc with this message.

private const int WM_CANCELMODE = 0x1F;

protected override void OnSizeChanged(System.EventArgs e)
{
if (this.Width < 200 ||
this.Height < 200)
{
Message msg = new Message();
msg.HWnd = this.Handle;
msg.Msg = WM_CANCELMODE;
this.WndProc( ref msg );
}

base.OnSizeChanged(e);
}
 
W

What-a-Tool

Thanks - looks like just what I want

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top