473,804 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Redrawing

How to force the redrawing of a Form?
Nov 20 '05 #1
5 1700
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******@ifran ce.com> wrote in message
news:3f******** *************** @news.free.fr.. .
How to force the redrawing of a Form?

Nov 20 '05 #2
"Michel" <mr******@ifran ce.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.Doe vents 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*******@free net.de> wrote in message
news:uZ******** ******@TK2MSFTN GP10.phx.gbl...
"Michel" <mr******@ifran ce.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.Doe vents 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*******@free net.de> a écrit dans le message de news:
uZ************* *@TK2MSFTNGP10. phx.gbl...
"Michel" <mr******@ifran ce.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.Doe vents 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********@ema il.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
3642
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 puposes only and is not normally visable to the user.) The Thread function is actually in the Form class. Now.. What I am seeing is that when I create an instance of this Class Library's Form, which starts the worker thread, it seems to hose up...
0
1514
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 puposes only and is not normally visable to the user.) The Thread function is actually in the Form class. Now.. What I am seeing is that when I create an instance of this Class Library's Form, which starts the worker thread, it seems to hose up...
3
3343
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 when the user saves the customer information. If the property "CreateNew" that comes along with the custom EventArgs is true, then the child form creates a new form for this. Here is the code: private void edit_Save(object sender,...
5
2225
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 remove the old images and add the new ones. And the set of images displayed is not the same from one state to the next. So I delete all the old ones first (effectively clearing the screen) before adding the new ones. Hope that makes sense, TIA,...
3
4168
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 until I have finished making these changes, to reduce the flicker. Can someone tell me how to do it ? Thanks
8
6388
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 any feasible solution, i need to use a checked listbox which also has same flickering problem on resize. Thanks & Regards
11
3478
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 MouseMove, the form is resized around a 30-100 times in one second. This leads to a high CPU utilization and all other application comes to a stand still. The form does not have any controls i.e. buttons, text boxes etc. It is completely...
4
4766
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 WndProc with WM_PAINT and WM_SIZE messages. however, under MFC there is a useful method called SetRedraw(bool); it allows or not, to redraw the relative control.
1
3498
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.? Thanks Steven
0
9716
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
9595
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
10604
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...
1
10359
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7643
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
6870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
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
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.