473,394 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Is there a done resizing event ?

I'm writing a new control derived from UserControl.
I need to get an event when the control is done resizing.

I tried the Resize, SizeChanged, Move and the Layout events and I also tried
to override them. But they all invoked when the control is in the middle of
the resizing process.

I'm not using breakpoints, I'm using trace to see which one is invoked and
when.

Is there an event that simply tells me when the resizing is done ?
---------
Thanks
Sharon
Nov 17 '05 #1
11 17770
Hi,
In case the window is being resized with a mouse, you can treat a mouseup
event to be end of resizing.
I hope that helps u.

-Ab.
http://joehacker.blogspot.com

"Sharon" <Sh*****@newsgroups.nospam> wrote in message
news:E3**********************************@microsof t.com...
I'm writing a new control derived from UserControl.
I need to get an event when the control is done resizing.

I tried the Resize, SizeChanged, Move and the Layout events and I also tried to override them. But they all invoked when the control is in the middle of the resizing process.

I'm not using breakpoints, I'm using trace to see which one is invoked and
when.

Is there an event that simply tells me when the resizing is done ?
---------
Thanks
Sharon

Nov 17 '05 #2
It looks like a good idea, but it's may be good for Forms, but I need it for
the control that I'm writing.
I'll explain:
The control that I'm writing can no be resized separately, it's being
resized by resizing its parent Form.
(The Form is setting my control Dock = None, Anchor = Top,Left,Right).
So when the user done resizing the Form, the MouseUp is in the Form context
and of the control.
I tried to set Parent.MouseUp (where Parent is the Form) event, but it is
not being fired.

So I'll be very happy to hear any more Ideas.
----------
Thanks
Sharon
--
Thanks
Sharon
"Abubakar" wrote:
Hi,
In case the window is being resized with a mouse, you can treat a mouseup
event to be end of resizing.
I hope that helps u.

-Ab.
http://joehacker.blogspot.com

"Sharon" <Sh*****@newsgroups.nospam> wrote in message
news:E3**********************************@microsof t.com...
I'm writing a new control derived from UserControl.
I need to get an event when the control is done resizing.

I tried the Resize, SizeChanged, Move and the Layout events and I also

tried
to override them. But they all invoked when the control is in the middle

of
the resizing process.

I'm not using breakpoints, I'm using trace to see which one is invoked and
when.

Is there an event that simply tells me when the resizing is done ?
---------
Thanks
Sharon


Nov 17 '05 #3
The following code works in visual studio 2k5:

private void UserControl1_Load(object sender, EventArgs e)
{
((Form)this.Parent).ResizeEnd += new EventHandler(UserControl1_ResizeEnd);
}
void UserControl1_ResizeEnd(object sender, EventArgs e)
{
MessageBox.Show("Resize end");
}

I hope that helps.

-Ab.
http://joehacker.blogspot.com

"Sharon" <Sh*****@newsgroups.nospam> wrote in message
news:A8**********************************@microsof t.com...
It looks like a good idea, but it's may be good for Forms, but I need it for the control that I'm writing.
I'll explain:
The control that I'm writing can no be resized separately, it's being
resized by resizing its parent Form.
(The Form is setting my control Dock = None, Anchor = Top,Left,Right).
So when the user done resizing the Form, the MouseUp is in the Form context and of the control.
I tried to set Parent.MouseUp (where Parent is the Form) event, but it is
not being fired.

So I'll be very happy to hear any more Ideas.
----------
Thanks
Sharon
--
Thanks
Sharon
"Abubakar" wrote:
Hi,
In case the window is being resized with a mouse, you can treat a mouseup event to be end of resizing.
I hope that helps u.

-Ab.
http://joehacker.blogspot.com

"Sharon" <Sh*****@newsgroups.nospam> wrote in message
news:E3**********************************@microsof t.com...
I'm writing a new control derived from UserControl.
I need to get an event when the control is done resizing.

I tried the Resize, SizeChanged, Move and the Layout events and I also

tried
to override them. But they all invoked when the control is in the middle
of
the resizing process.

I'm not using breakpoints, I'm using trace to see which one is invoked

and when.

Is there an event that simply tells me when the resizing is done ?
---------
Thanks
Sharon


Nov 17 '05 #4
That is very good, But I'm using the VS 2003 that does not have the
ResizedEnd event.

----
Thanks
Sharon
Nov 17 '05 #5
Hi Sharon,

Thanks for your feedback.

First, you should determine if ResizeEnd event meets your need. This event
is raised when the user finishes resizing a form, typically by dragging one
of the borders or the sizing grip located on the lower-right corner of the
form, and then releasing it. It is also generated after the user moves a
form, typically by clicking and dragging on the caption bar.

So for the second scenario, I do not think it meet your need. However, I
think we can distinguish these 2 conditions with comparing the new control
size with the original control size.(This requires to store the original
control size in a private filed/property)

Ok, I assume that you need this event in .Net1.1. Let's do some
customization to achieve this:
Form.ResizeEnd event leverages win32 WM_EXITSIZEMOVE message, so in
.Net1.1, we can override Form's WndProc and create a public ResizeEnd
event, trigger this event in WM_EXITSIZEMOVE message, like below:

public event EventHandler ResizeEnd;
private int WM_EXITSIZEMOVE=0x232;
protected override void WndProc(ref Message m)
{
if(m.Msg==WM_EXITSIZEMOVE)
{
if(ResizeEnd!=null)
{
this.ResizeEnd(this, new EventArgs());
}
}
base.WndProc (ref m);
}

In usercontrol, we can just listen to this event:
//I write code to disable this code from running in designmode.
private void UserControl1_Load(object sender, System.EventArgs e)
{
if(!this.DesignMode)
{
((Form1)this.Parent).ResizeEnd += new
EventHandler(UserControl1_ResizeEnd);
}
else
{
MessageBox.Show("design time");
}
}

private void UserControl1_ResizeEnd(object sender, EventArgs e)
{
MessageBox.Show("Resize end");
}

Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #6
Thanks Jeffrey,
But I'm only writing the control that will be used in Forms that I have no
control over them.

As I understand your suggestion; the event is fired by the Form.
So you see, it's very good for the Form developer, but not for the control
developer.

I found some discussion that suggest to use the Application.Idle event.
So on the regular OnResize I'm only marking a flag that indicate that a
resizing operation is in progress, and the event handler that is register for
the Application.Idle event is doing the resizing (as if ResizeEnd is fired)
when the flag is marked.
It seems to be working, but I'm not so sure it will work at any scenario.

What do you think?
----------
Thanks
Sharon
Nov 20 '05 #7
Hi SharonG,

First, I think I have showed you the code how to register the form's
ResizeEnd event in UserControl, yes? So we should can do this in the
control development, not just the Form level. Do you have any concern on
this way?

Second, I am not sure what is your definition of resizing end. Based on my
experience, the Resize event should occurs at the end of the resizing
operation, yes? Please feel free to tell me concern about this.

Third, the Application.Idle should can get this done. Because this event
occurs when the application finishes processing and is about to enter the
idle state. So the Resizing operation should have been finished.

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 21 '05 #8
Jeffrey,

Wouldn't it be better to subscribe to the parent form's Resize_End
event in a ParentChanged event handler, rather than in a Load event
handler?

Nov 21 '05 #9
Yes, the code you showed me is perfect. But I prefer a solution that won't
involve the user of the control.

My definition of 'resizing end' is the mouse up when the user is done
pooling the Form corner.
So I think that our detentions are the same.

I'm glad to hear that the Application.Idle event usage is a good solution.
As you can see it does not need any involvement by the user of my control.

-----------
Thanks a lot
Sharon
Nov 21 '05 #10
Yes, it would be better to register to the ResizeEnd event of the parent
Form. But this event is only exist in VS 2005 and not in VS2003.
The Solution that Jeffrey has suggested is for VS2003.
Nov 21 '05 #11
Oh, yes, it;'s better can use the control without requiring doing extra
work in Form class. So the solution you found should be better.

If you have any further concern, please feel free to post. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 21 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gord | last post by:
Hello, Anybody know how to detect when a user drags between columns in a MSHFlexGrid when resizing column width? (Short of setting up a timer event that continuously monitors column width.)...
0
by: TJ Talluto | last post by:
<facts> I have a "month calendar" that always displays exactly 42 days... and alongside is a vertical box that displays the detail (form fields) of any particular select event that appears on the...
2
by: Poewood | last post by:
I put instructions within the Resize Event handler of a PocketPC program. The instructions basically reset the sizes and locations of the objects on the form. I base everything on the Form Height...
12
by: Søren Reinke | last post by:
Hi there I have a little problem. How do i make sure that a graph is not redrawn while the form with the graph is being resized ? I have tried to add a mouse up/down event handler on the...
13
by: Martin Ho | last post by:
I know this must be trivial for many of you. But I am playing with this and can't figure it out. I have a form, on that form is one panel which has 3 textboxes, when I run my program and...
13
by: bgraphics2031 | last post by:
I'm trying to get this iframe to dynamically resize by dragging a vertical bar, but it's not working in Mozilla (It originally worked in IE but I've been trying to port it over). Any help will be...
6
by: JDeats | last post by:
I have a WinForms based application written for the .NET Framework 2.0 and in this application I need to be able to be able to take some action in code when the user finishes resizing the form. ...
1
by: Nick | last post by:
Hi, I have created a html page from Java and I have added a .js file which can resize a TextArea inside the html on mousedown event. <script src="C:\temp\resize.js"</script> <table<tr><td...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.