473,756 Members | 8,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 17870
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*****@newsgr oups.nospam> wrote in message
news:E3******** *************** ***********@mic rosoft.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*****@newsgr oups.nospam> wrote in message
news:E3******** *************** ***********@mic rosoft.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_Lo ad(object sender, EventArgs e)
{
((Form)this.Par ent).ResizeEnd += new EventHandler(Us erControl1_Resi zeEnd);
}
void UserControl1_Re sizeEnd(object sender, EventArgs e)
{
MessageBox.Show ("Resize end");
}

I hope that helps.

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

"Sharon" <Sh*****@newsgr oups.nospam> wrote in message
news:A8******** *************** ***********@mic rosoft.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*****@newsgr oups.nospam> wrote in message
news:E3******** *************** ***********@mic rosoft.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_EX ITSIZEMOVE)
{
if(ResizeEnd!=n ull)
{
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_Lo ad(object sender, System.EventArg s e)
{
if(!this.Design Mode)
{
((Form1)this.Pa rent).ResizeEnd += new
EventHandler(Us erControl1_Resi zeEnd);
}
else
{
MessageBox.Show ("design time");
}
}

private void UserControl1_Re sizeEnd(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.Idl e 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.Idl e 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.Idl e 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.Idl e 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

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

Similar topics

1
10964
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.) MouseDown, MouseUp, MouseMove, MouseIcon etc. all seem to be 'blind' when my mouse cursor changes to the horizontal double headed arrow for column resizing. No events seem to be triggered when the mouse pointer is in this state? Thanks,
0
2625
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 calendar, so that the event may be changed, or a new event may be created. monthname X X X X X X X form X X X X X X X form X X X X X X X form
2
1424
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 and Width. The problem the resizing doesn't occur. The variables are set but the objects don't change. If I can get a notification of when the resizing event has finished then I can change the object sizes. Any suggestions ould be appreciated....
12
6733
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 form1, but it dosn't get called when resizing :( I would like to be able to resize my form, but also make sure the graph is
13
2510
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 maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving...
13
4413
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 appreciated. Here's the resize.js var sResizableElement = "TH"; //Elements to be resized var iResizeThreshold = 8; var iEdgeThreshold = 8; var iSizeThreshold = 20; var sVBarID = "VBar"; var oResizeTarget = null; //position and distance moved
6
4548
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. I can easily create an event handler for the SizeChanged form level event, the problem is if the user is using a mouse drag to resize the form this event is firing every few milliseconds or what have you until the user stops the drag process. ...
1
2793
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 onmousedown="javascript:resize('trinput',event)"> <TEXTAREA NAME="input" id="trinput" COLS=40 ROWS=60> my textarea here </TEXTAREA>
0
9456
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10040
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.