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. Suppress Paint Event

Suppress Paint Event

Scheduled Pinned Locked Moved C#
winformstutorialquestion
3 Posts 3 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.
  • A Offline
    A Offline
    Andrei Ungureanu
    wrote on last edited by
    #1

    Hy, Can anyone tell me a way to supress the paint event in Windows Forms? I have on my form several controls and I don't want them to be redrawn when I maximize the form (for example). Thanks Do your best to be the best

    L J 2 Replies Last reply
    0
    • A Andrei Ungureanu

      Hy, Can anyone tell me a way to supress the paint event in Windows Forms? I have on my form several controls and I don't want them to be redrawn when I maximize the form (for example). Thanks Do your best to be the best

      L Offline
      L Offline
      LongRange Shooter
      wrote on last edited by
      #2

      Any time the state of the window changes (maximize, minimize, move a mouse, drag a form across....) it invalidates the view since that view is no longer valid. If you suppressed the Paint event then your controls would disappear from the view by the vary nature of Invalidate(). I'm curious as to the logic behind not redrawing the controls...perhaps there is another route that keeps your controls visible.

      1 Reply Last reply
      0
      • A Andrei Ungureanu

        Hy, Can anyone tell me a way to supress the paint event in Windows Forms? I have on my form several controls and I don't want them to be redrawn when I maximize the form (for example). Thanks Do your best to be the best

        J Offline
        J Offline
        Josh Smith
        wrote on last edited by
        #3

        If you want to prevent the Paint event from firing (which is a very odd thing to do, btw), then you can override OnPaint and do not call the base implementation. The base impl fires the event. :josh: My WPF Blog[^]

        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