After Form Re-Size event?

W

What-a-Tool

Have an action I want triggered after a form is dragged to a certain size.
Right now the code I am calling is running repeatedly during the whole drag
to size action. I would like it to run only after the drag to size action
has been completed.
(Using VS 2002 - VB)

Is this possible?

Thanks in advance for any help

--

/ Sean the Mc /


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

AlexS

Hi, What-a-Tool

Did you try to use mouse events together with Resize handler? While mouse is
down resize is not done - basic assumption.
When doing resize by keyboard - you can check keyboard status in Resize
event. Resize will complete when key is up.

HTH
Alex
 
W

What-a-Tool

Grabbing the border of my form doesn't trigger any mouse events that I can
find.

Sorry if I seem a little dense here, but how do you mean?

I can stop an event from happening during the resize with :

If Me.Mousebuttons <> Mousebutton.left
<action>
End If

but that still won't trigger it when I stop resizing and release. (no
re-sizing with keyboard)


--

/ Sean the Mc /


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

AlexS

Hi,

I meant WM_ and WM_NC messages, which allow to intercept mouse or sizing
related events for non-client areas of windows. Border is not in client area
unfortunately. You have to check Platform SDK for all the details if you
want to know more. In your program you need to override WndProc and to be
able to intercept these messages. In particular you might be able to do what
you want with WM_NCCALCSIZE and WM_NCHITTEST.

If you have thick border you can also intercept WM_GETMINMAXINFO and
WM_WINDOWPOSCHANGED. But you have to check docs to find out what would be
best in your case.

Use these procedures in your form to understand sequence of messages and how
to deal with situation:

[System.Security.Permissions.PermissionSet(System.Security.Permissions.Secur
ityAction.Demand, Name="FullTrust")]

protected override void WndProc(ref Message m)

{

Console.WriteLine(m.Msg.ToString());

base.WndProc(ref m);

}


[System.Security.Permissions.PermissionSet(System.Security.Permissions.Secur
ityAction.Demand, Name="FullTrust")]

public override bool PreProcessMessage(ref Message msg) {

Console.WriteLine(msg.Msg.ToString());

return base.PreProcessMessage(ref msg);

}


I hope you can easily translate it to VB. These will print all messages,
which you get for NC and client areas as they appear.


HTH
Alex
 
W

What-a-Tool

Thank you very much - very helpfull.

--

/ Sean the Mc /


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

AlexS said:
Hi,

I meant WM_ and WM_NC messages, which allow to intercept mouse or sizing
related events for non-client areas of windows. Border is not in client area
unfortunately. You have to check Platform SDK for all the details if you
want to know more. In your program you need to override WndProc and to be
able to intercept these messages. In particular you might be able to do what
you want with WM_NCCALCSIZE and WM_NCHITTEST.

If you have thick border you can also intercept WM_GETMINMAXINFO and
WM_WINDOWPOSCHANGED. But you have to check docs to find out what would be
best in your case.

Use these procedures in your form to understand sequence of messages and how
to deal with situation:

[System.Security.Permissions.PermissionSet(System.Security.Permissions.Secur
ityAction.Demand, Name="FullTrust")]

protected override void WndProc(ref Message m)

{

Console.WriteLine(m.Msg.ToString());

base.WndProc(ref m);

}


[System.Security.Permissions.PermissionSet(System.Security.Permissions.Secur
ityAction.Demand, Name="FullTrust")]

public override bool PreProcessMessage(ref Message msg) {

Console.WriteLine(msg.Msg.ToString());

return base.PreProcessMessage(ref msg);

}


I hope you can easily translate it to VB. These will print all messages,
which you get for NC and client areas as they appear.


HTH
Alex


What-a-Tool said:
Grabbing the border of my form doesn't trigger any mouse events that I can
find.

Sorry if I seem a little dense here, but how do you mean?

I can stop an event from happening during the resize with :

If Me.Mousebuttons <> Mousebutton.left
<action>
End If

but that still won't trigger it when I stop resizing and release. (no
re-sizing with keyboard)


--

/ Sean the Mc /


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

mouse
 

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