473,466 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Form Redrawing

How to force the redrawing of a Form?
Nov 20 '05 #1
5 1678
Michel,
You can use either:
- Form.Invalidate optionally followed by Form.Update
- Form.Refresh
- Form.Update (if the form was already indirectly invalidated).

Refresh - does an Invalidate followed by Update.

Invalidate - invalidates a specific region of the Control (defaults to
entire client area) and causes a paint message to be sent to the control.

Update - causes the Paint event to occur immediately (Windows will normally
wait until there are no other messages for the window to process).

All three methods are inherited from Control, so you can use them with any
control.

Hope this helps
Jay

"Michel" <mr******@ifrance.com> wrote in message
news:3f***********************@news.free.fr...
How to force the redrawing of a Form?

Nov 20 '05 #2
"Michel" <mr******@ifrance.com> schrieb
How to force the redrawing of a Form?


In addition to Jay's reply: This does work but pay attention when using
WinXP. The window/Form doesn't update after a few seconds even if you call
Refresh! Unfortunatelly, there's no way to force the update. The name for
this annoying "feature" in WinXP is called "ghost window". Search MSDN for
this term. On WinXP, you are now forced to execute Application.Doevents or
put the work in another thread. Both solutions may lead to a lot of more
work than in previous OSes.
--
Armin

Nov 20 '05 #3
Armin,
Curious, I am running WinXP and am using Refresh and it IS updating the
screen and I am not using DoEvents. ;-)

However I am not blocking the windows message queue, I'm in the middle of
dragging the mouse which is flooding the windows message queue with mouse
messages, not allowing the Paint message to be seen. Hence needing Refresh
over just invalidate. In other words threads & do events are not appropriate
in my case. I do use just invalidate in some other places as I do not need
to update the screen immediately...

Do you have a (more) specific link that you are referring to? The one I
found was titled "About Messages and Message Queues", I didn't realize that
XP used a ghost window when you app is hung (i.e. its blocking reading the
windows message queue).

Calling Doevents (or coming up for air as I sometimes say) was a good idea
even in previous versions of Windows. At the very least it allows you to
display a cancel button, so the user can cancel the operation.

Thanks for the additional info.

Jay

"Armin Zingler" <az*******@freenet.de> wrote in message
news:uZ**************@TK2MSFTNGP10.phx.gbl...
"Michel" <mr******@ifrance.com> schrieb
How to force the redrawing of a Form?


In addition to Jay's reply: This does work but pay attention when using
WinXP. The window/Form doesn't update after a few seconds even if you call
Refresh! Unfortunatelly, there's no way to force the update. The name for
this annoying "feature" in WinXP is called "ghost window". Search MSDN for
this term. On WinXP, you are now forced to execute Application.Doevents or
put the work in another thread. Both solutions may lead to a lot of more
work than in previous OSes.
--
Armin

Nov 20 '05 #4
Thanks for your help,
I already use the refresh into the resize event,
but unfortunatly the mainmenu control on the form
is not redrawed on any case.
That means I need to refresh the control?
I'm trying to use the Me.resizeREdraw = true.
I obtain the good result but at the second resize.
I think the menu is redrawing before that I obtain the resize event
to late to give the right size of my Form?

I run in W2K.

"Armin Zingler" <az*******@freenet.de> a écrit dans le message de news:
uZ**************@TK2MSFTNGP10.phx.gbl...
"Michel" <mr******@ifrance.com> schrieb
How to force the redrawing of a Form?


In addition to Jay's reply: This does work but pay attention when using
WinXP. The window/Form doesn't update after a few seconds even if you call
Refresh! Unfortunatelly, there's no way to force the update. The name for
this annoying "feature" in WinXP is called "ghost window". Search MSDN for
this term. On WinXP, you are now forced to execute Application.Doevents or
put the work in another thread. Both solutions may lead to a lot of more
work than in previous OSes.
--
Armin

Nov 20 '05 #5
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> schrieb
Armin,
Curious, I am running WinXP and am using Refresh and it IS updating
the screen and I am not using DoEvents. ;-)

However I am not blocking the windows message queue, I'm in the
middle of dragging the mouse which is flooding the windows message
queue with mouse messages, not allowing the Paint message to be seen.
Hence needing Refresh over just invalidate. In other words threads &
do events are not appropriate in my case. I do use just invalidate in
some other places as I do not need to update the screen
immediately...

Do you have a (more) specific link that you are referring to?
Only the one...
The one
I found was titled "About Messages and Message Queues",
....you mention here.
I didn't
realize that XP used a ghost window when you app is hung (i.e. its
blocking reading the windows message queue).

Calling Doevents (or coming up for air as I sometimes say) was a good
idea even in previous versions of Windows. At the very least it
allows you to display a cancel button, so the user can cancel the
operation.


You are right, but in previous versions it was still up to me - at least for
internal apps and tools that don't need such a "responsive" UI. I figured it
out when upgrading an application from VB6 that processes a database and
shows the progress (the current database table) in a statusbar. I wondered
why it suddenly takes such a long time to process a single table. Later I
came across this XP "feature" and that only the display, not the application
freezes. Rather annoying. The developers of XP probably thought that they
can show this ghost window because the application doesn't process the
_input_, but they obviously forgot that there is still _output_. At least
there should be an option to turn it off.

--
Armin

Nov 20 '05 #6

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

Similar topics

5
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
0
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
3
by: Bruno Rodrigues | last post by:
Hi all I have an application in wich you can insert a new costumer, and like in Microsoft Outlook 2003, and option "Save and New". To deal this, I have an event in the edit form, that is raised...
5
by: J L | last post by:
I am removing and adding picture boxes on a form. I would like to have the old image form remain until I have completed the changes. Is that possible? As it is now, the form appears to blink as I...
3
by: Jon Vaughan | last post by:
I have a form that im using to draw buttons onto, a click on the buttons will cause the text on the buttons to change and some buttons will be hidden , so im looking to stop the redraw on the form...
8
by: nirdeshonline | last post by:
Hi, I have added a simple listbox in windows form under c# 2.0. It contains a collection of approx 10 strings as list items. Now when i resize the form whole listbox flickers. Please tell me...
11
by: Ajith Menon | last post by:
I have created a windows application in which the form needs to be resized on the MouseMove event. The windows resize function takes a lot of CPU cycles. And as the resize function is called on the...
4
by: R.A.F. | last post by:
Hi, Basically i've read that under C++ we can avoid flickering forms during sizing (maximize, minimize, restore,...) in SDi/MDI application. I understood that for that i need to override the...
1
by: NCC | last post by:
Hi all, In Access VB I could call echo() to stop my form from redrawing during computations then have it redraw upon completion. Is there a method for this in Visual C# or the .net framework.? ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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...
1
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...
0
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,...
0
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...
0
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 ...

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.