0

New to programming and English is not my first language. I am having a hard time trying to understand the difference of Control.Update() and Control.Refresh() the MSDN documentation.

I am trying to display real time image to the picturebox, but i dont know which method to use will be best. Like, in what kind of situation should i use Control.Update() over Control.Refresh, or do i use both of them?

P.s if this is a dumb question.

Jarad
  • 41
  • 1
  • 9

1 Answers1

2

Refresh( ) calls Invalidate(true) to invalidate the control and its children and then calls Update( ) to force paint the control so that the invalidation is synchronous.

More details here.

In short:

  • Calling the Invalidate() method does not force a synchronous paint;
  • to force a synchronous paint, call the Update method after calling the Invalidate method.
  • Calling refresh() does both Invalidate() + Update()
David
  • 15,894
  • 22
  • 55
  • 66
  • ya i read that but i got confused. So basically all i need to do is just use Refresh() and then ignore the Update(). Since by using Refresh(), it will invalidate the control and then automatically call Update()? – Jarad Dec 21 '17 at 03:31
  • @Jarad Well most of the time you just call `Invalidate()`. The others hurt performance too much –  Dec 21 '17 at 03:36