Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / April 2008

Tip: Looking for answers? Try searching our database.

resize events on windows form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tarren - 23 Apr 2008 15:28 GMT
Hi:

I am trying to get access to the event after a window has been resized.  The
events I have been using SizeChanged and Resize all fire after any pixel
size change.

What I am trying to achieve is after the window has been dragged to a new
size (or maximized/restored) then I redraw the images within the form.

If I do it on Resize, then it tries to redraw as the form is being resized,
which is not what I want.  Is there some way I can get to the event and fire
only after they are done resizing?

Thanks.
zacks@construction-imaging.com - 23 Apr 2008 15:44 GMT
> Hi:
>
[quoted text clipped - 8 lines]
> which is not what I want.  Is there some way I can get to the event and fire
> only after they are done resizing?

Set a flag (boolean variable) to true in the Resize event. Then, in
the MouseUp event, check the flag. If true, reset to false, and
perform your resizing code.
Tarren - 23 Apr 2008 16:06 GMT
thanks!  I will try that out

On Apr 23, 10:28 am, "Tarren" <noemailple...@thanks.com> wrote:
> Hi:
>
[quoted text clipped - 11 lines]
> fire
> only after they are done resizing?

Set a flag (boolean variable) to true in the Resize event. Then, in
the MouseUp event, check the flag. If true, reset to false, and
perform your resizing code.
Andrus - 23 Apr 2008 18:43 GMT
> Set a flag (boolean variable) to true in the Resize event. Then, in
> the MouseUp event, check the flag. If true, reset to false, and
> perform your resizing code.

Why you recommend so sophisticated solution ?

Form has ResizeEnd event which is designed for this. So your trick is not
required.

Andrus.
zacks@construction-imaging.com - 23 Apr 2008 19:04 GMT
> > Set a flag (boolean variable) to true in the Resize event. Then, in
> > the MouseUp event, check the flag. If true, reset to false, and
[quoted text clipped - 4 lines]
> Form has ResizeEnd event which is designed for this. So your trick is not
> required.

I was not familiar with the ResizeEnd event.

If nothing else, it would be a good exercise to do. Helps to
understand form event handling.
Peter Duniho - 23 Apr 2008 17:58 GMT
> [...]
> If I do it on Resize, then it tries to redraw as the form is being  
> resized, which is not what I want.  Is there some way I can get to the  
> event and fire only after they are done resizing?

Yes.  Handle the ResizeEnd event instead of Resize or SizeChanged.

Pete
Charles Calvert - 23 Apr 2008 23:40 GMT
>> [...]
>> If I do it on Resize, then it tries to redraw as the form is being  
>> resized, which is not what I want.  Is there some way I can get to the  
>> event and fire only after they are done resizing?
>
>Yes.  Handle the ResizeEnd event instead of Resize or SizeChanged.

Note that if you're handling this in the form class itself, you should
override OnResizeEnd instead.  The documentation states "The
OnResizeEnd method also allows derived classes to handle the event
without attaching a delegate. This is the preferred technique for
handling the event in a derived class."
Signature

Charles Calvert             |  Software Design/Development
Celtic Wolf, Inc.           |  Project Management
http://www.celticwolf.com/  |  Technical Writing
(703) 580-0210              |  Research


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.