Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Repaint form using Invalidate()

Repaint form using Invalidate()

Scheduled Pinned Locked Moved C#
graphicstutorialannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gmeii
    wrote on last edited by
    #1

    I need to know how to re-draw graphics on my forms when the forms are minimized or lose focus. I know there are an Update() and Invalidate() method but when I use them they don't work. I need to know where to put them actually. I already know that the OnPaint() method is called when the form loses focus and graphics need to be drawn. The reason i don't want to go that route is because I am using a button control that when pressed, there are counters that will change the coordinates of the graphic shape. This means I would have to save the current state or coordinates after each time the button is pressed and it would be a hassle to pass all of this to the OnPaint() method, even though it could be done. I just need a simple way to redraw my graphics in the forms.

    S 1 Reply Last reply
    0
    • G gmeii

      I need to know how to re-draw graphics on my forms when the forms are minimized or lose focus. I know there are an Update() and Invalidate() method but when I use them they don't work. I need to know where to put them actually. I already know that the OnPaint() method is called when the form loses focus and graphics need to be drawn. The reason i don't want to go that route is because I am using a button control that when pressed, there are counters that will change the coordinates of the graphic shape. This means I would have to save the current state or coordinates after each time the button is pressed and it would be a hassle to pass all of this to the OnPaint() method, even though it could be done. I just need a simple way to redraw my graphics in the forms.

      S Offline
      S Offline
      Sharpoverride
      wrote on last edited by
      #2

      save all the graphics in an ArrayList make some class like Elipse , Arc.. etc OnPaint() foreach ( drawing in myDrawings ) { drawing.Draw( e.Grahics ) ; } Lazar Mihai Highschool student

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups