473,769 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Invalidate() compared to Refresh()

picDocument is a picturebox

When I do picDocument.Inv alidate() the box paints.

But if instead I do picDocument.Ref resh() the box does not paint.

What does Refresh do. I guessed it did an Invalidate and an Update.

Can someone shed some light?

Thanks


Nov 20 '05 #1
17 8540
Refresh doesn't send a paint message to the control. It's telling the
control to redraw itself.
" SamSpade" <st************ **@REMOVEaol.co m> wrote in message
news:O$******** ******@TK2MSFTN GP11.phx.gbl...
picDocument is a picturebox

When I do picDocument.Inv alidate() the box paints.

But if instead I do picDocument.Ref resh() the box does not paint.

What does Refresh do. I guessed it did an Invalidate and an Update.

Can someone shed some light?

Thanks

Nov 20 '05 #2
* "yEaH rIgHt" <nospam@haha> scripsit:
Refresh doesn't send a paint message to the control. It's telling the
control to redraw itself.


What's the difference?

(I know the difference, but I want to hear it ;-))

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Refresh doesn't send a paint message to the control. It's telling the
control to redraw itself.


What's the difference?

(I know the difference, but I want to hear it ;-))


I don't think the >> above answers my question but let me take a stab at
answering yours.
By paint message I think he means paint event so sending a paint message
means raising the paint event.

Telling a contoll to redraw itself might means sending an Update message.

What do you think??

I know of the WindowsAPI's Invalidate and Update.
I'd guess Refresh does them both but that does not agree with what I
observed.
What I'd like to know is:
When I does picDocument.Inv alidate() the box paints.
But if instead I do picDocument.Ref resh() the box does not paint.

Nov 20 '05 #4
SamSpade,
Control.Refresh - does a Control.Invalid ate immediately followed by
Control.Update.

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

Control.Update - causes the Paint event to occur immediately (Windows will
normally wait until there are no other messages for the window to process,
before raising the Paint event).
Refresh can be overridden, have you overridden it to change its behavior?
The paint event of course is where all the drawing of your PictureBox
occurs. Note there is only one pending Paint event, if you call Invalidate 3
times, you will still only receive one Paint event.

Hope this helps
Jay

" SamSpade" <st************ **@REMOVEaol.co m> wrote in message
news:O$******** ******@TK2MSFTN GP11.phx.gbl...
picDocument is a picturebox

When I do picDocument.Inv alidate() the box paints.

But if instead I do picDocument.Ref resh() the box does not paint.

What does Refresh do. I guessed it did an Invalidate and an Update.

Can someone shed some light?

Thanks

Nov 20 '05 #5
>By paint message I think he means paint event so sending a paint message
means raising the paint event.
That's what I meant. It doesn't raise an paint event for you to use.
" SamSpade" <st************ **@REMOVEaol.co m> wrote in message
news:Oy******** ******@TK2MSFTN GP12.phx.gbl...
Refresh doesn't send a paint message to the control. It's telling the
control to redraw itself.


What's the difference?

(I know the difference, but I want to hear it ;-))


I don't think the >> above answers my question but let me take a stab at
answering yours.
By paint message I think he means paint event so sending a paint message
means raising the paint event.

Telling a contoll to redraw itself might means sending an Update message.

What do you think??

I know of the WindowsAPI's Invalidate and Update.
I'd guess Refresh does them both but that does not agree with what I
observed.
What I'd like to know is:
When I does picDocument.Inv alidate() the box paints.
But if instead I do picDocument.Ref resh() the box does not paint.

Nov 20 '05 #6
If you know the answer then why don't you tell us, master?

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:OT******** ******@TK2MSFTN GP11.phx.gbl...
* "yEaH rIgHt" <nospam@haha> scripsit:
Refresh doesn't send a paint message to the control. It's telling the
control to redraw itself.


What's the difference?

(I know the difference, but I want to hear it ;-))

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #7
Yeah Right,
Are you certain?

In VS.NET 2002 & VS.NET 2003 Refresh calls Invalidate & Update methods, the
Update method sends the paint message to the control.

For details see:
http://msdn.microsoft.com/library/de...dateTopic1.asp

http://msdn.microsoft.com/library/de...pdateTopic.asp

http://msdn.microsoft.com/library/de...freshTopic.asp
Or are you using Mono? Is it different in Mono? Or are you simply stating
that Refresh does not directly send the paint message, that it sends it
indirectly via the Update?

Just curious
Jay

"yEaH rIgHt" <nospam@haha> wrote in message
news:10******** *****@corp.supe rnews.com...
Refresh doesn't send a paint message to the control. It's telling the
control to redraw itself.
" SamSpade" <st************ **@REMOVEaol.co m> wrote in message
news:O$******** ******@TK2MSFTN GP11.phx.gbl...
picDocument is a picturebox

When I do picDocument.Inv alidate() the box paints.

But if instead I do picDocument.Ref resh() the box does not paint.

What does Refresh do. I guessed it did an Invalidate and an Update.

Can someone shed some light?

Thanks


Nov 20 '05 #8
* "yEaH rIgHt" <nospam@haha> scripsit:
If you know the answer then why don't you tell us, master?


Because Jay has already done it ;-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #9
Jay, you're right. I made a stupid blunder. I had a button click event with
the ReFresh method in it but I was hitting the wrong button. I guess I
shouldn't answer questions late at night. D'OH!!!
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:eQ******** ******@TK2MSFTN GP09.phx.gbl...
Yeah Right,
Are you certain?

In VS.NET 2002 & VS.NET 2003 Refresh calls Invalidate & Update methods, the Update method sends the paint message to the control.

For details see:
http://msdn.microsoft.com/library/de...dateTopic1.asp
http://msdn.microsoft.com/library/de...pdateTopic.asp
http://msdn.microsoft.com/library/de...freshTopic.asp

Or are you using Mono? Is it different in Mono? Or are you simply stating
that Refresh does not directly send the paint message, that it sends it
indirectly via the Update?

Just curious
Jay

"yEaH rIgHt" <nospam@haha> wrote in message
news:10******** *****@corp.supe rnews.com...
Refresh doesn't send a paint message to the control. It's telling the
control to redraw itself.
" SamSpade" <st************ **@REMOVEaol.co m> wrote in message
news:O$******** ******@TK2MSFTN GP11.phx.gbl...
picDocument is a picturebox

When I do picDocument.Inv alidate() the box paints.

But if instead I do picDocument.Ref resh() the box does not paint.

What does Refresh do. I guessed it did an Invalidate and an Update.

Can someone shed some light?

Thanks



Nov 20 '05 #10

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

Similar topics

1
14132
by: Amy | last post by:
What's different between Controls method Refresh() and Invalidate(), Refresh() and Update()? Your help will be appreciated. Thanks.
1
29234
by: Claus Konrad | last post by:
What's the difference between calling the first and the second (see subject). Thanks! /Claus
3
3784
by: Marge Inoferror | last post by:
I am trying to display a number of images and have them scale when the window is resized. I have all the code to draw the window in an OnPaint() override. However, it only draws correctly the first time it is displayed. When I resize the window, it keeps the remnants of the first window and redraws only in "new" areas of the window. Is there a way to invalidate the entire window when OnPaint is invoked? I
4
4638
by: grayaii | last post by:
Hi, I have a simple form that handles all its paint functionality like so: this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); And the entry point to this program is like so: static void Main() {
1
3614
by: sean | last post by:
I'm trying to create "rubber-band" rectangles by overriding the OnPaint method to place rectangles on top of all graphic controls, but when I call Me.Invalidate() (when the user moves the mouse), OnPaint is not getting called... Here is the relevent code: I'm trying to create a "rubber band" rectangle effect on my form. Private Sub HighlightSectionOfTrack(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles...
2
7366
by: active | last post by:
Refresh says: -Forces the control to invalidate its client area and immediately redraw itself and any child controls. Not the Menu for example? While Invalidate() says: -Invalidates the entire surface of the control and causes the control to be redrawn. Does "the entire surface" mean more then the client area?
5
2425
by: tshad | last post by:
I have an interface I am using to get access to some of the objects on my form: a textbox (Status) and my statusbar (StatusBar). In my class, which is actually in another class from my form I have the following: public interface IStatusDisplay { string Status { get; set; } string StatusBar { get; set; } }
1
1299
by: William Dauchy | last post by:
Hello, I have a button which put a value in a variable when a click happened. This variable is part of data binding, and is connected to a textbox. In the method which receive the click button I finished by calling the invalidate method of the textbox. But nothing happens (I mean, the textbox isnt update) until I click on another radio button somewhere in the UI. What should I do to update the textbox immediately?
5
5843
by: kveerareddy | last post by:
Hi experts, Technologies: Spring, AJAX, Google web tool kit Problem: Ideally when the user stops using a web page then after 30 minutes, if the user is trying to access any ting then the session gets expired. But In my case one pages continually refreshes for every 30 seconds, hence not giving scope to session timeout even when the user stops using it. Questions: Is there any way to stop resetting of time in some specific cases, for...
0
9579
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
9422
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
10035
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...
1
9984
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
7403
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
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
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
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
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.