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. .NET (Core and Framework)
  4. Refreshing Panel

Refreshing Panel

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpgraphicstutorial
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.
  • K Offline
    K Offline
    Kiki99
    wrote on last edited by
    #1

    I have one problem I don't know how to refresh the panel (pane.Refresh()-don't work). I drawing on panel like: Graphic g = panel2.CreateGraphics(); g.DrawLine(new Pen(Color.Blue), 100,100,200,200); .... How to Refresh, please help me!

    C A 2 Replies Last reply
    0
    • K Kiki99

      I have one problem I don't know how to refresh the panel (pane.Refresh()-don't work). I drawing on panel like: Graphic g = panel2.CreateGraphics(); g.DrawLine(new Pen(Color.Blue), 100,100,200,200); .... How to Refresh, please help me!

      C Offline
      C Offline
      Chua Wen Ching
      wrote on last edited by
      #2

      Hi, Try this instead. private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Refresh(); } Hope it helps. Cheers. Regards, Chua Wen Ching Visit us at http://www.necoders.com

      1 Reply Last reply
      0
      • K Kiki99

        I have one problem I don't know how to refresh the panel (pane.Refresh()-don't work). I drawing on panel like: Graphic g = panel2.CreateGraphics(); g.DrawLine(new Pen(Color.Blue), 100,100,200,200); .... How to Refresh, please help me!

        A Offline
        A Offline
        afinnell
        wrote on last edited by
        #3

        Doesn't it seem like this will be the order of events? * (Your code) Create graphics object * (Your code) Draw on pane * (Your code) Refresh pane * (WinForm code) Clear background (thus removing your previous drawing) * (WinForm code) redraw pane It might be that your drawing is getting painted over when you refresh your pane. You can create a delegate and add it to the pane.Paint event, then draw using the supplied graphics object. - Drew

        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