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. Windows Forms
  4. Parent UserControl fails to draw when child UserControl is updated.

Parent UserControl fails to draw when child UserControl is updated.

Scheduled Pinned Locked Moved Windows Forms
announcement
3 Posts 2 Posters 2 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.
  • C Offline
    C Offline
    cjb110
    wrote on last edited by
    #1

    I've got a UserControl that contains a panel, that is meant to contain other controls but only of a certain type. This type is another UserControl that implements a specific interface. Now I can add this child UserControl and it displays ok. But none of controls on the child user control display, and when I update a property of one of those controls (say the .Text) my parent control stops being drawn (big red cross :(), the child UserControl is still drawn though. Any ideas...I think its either a setting on Parent UserControl, or maybe an interface I'm missing.

    D 1 Reply Last reply
    0
    • C cjb110

      I've got a UserControl that contains a panel, that is meant to contain other controls but only of a certain type. This type is another UserControl that implements a specific interface. Now I can add this child UserControl and it displays ok. But none of controls on the child user control display, and when I update a property of one of those controls (say the .Text) my parent control stops being drawn (big red cross :(), the child UserControl is still drawn though. Any ideas...I think its either a setting on Parent UserControl, or maybe an interface I'm missing.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Are you doing any drawing yourself or just relying on the controls to draw themselves?? If your code is taking too long to do anything during a repaint, you can get the Big Red X. If your code is doing custom drawing, then you either didn't use the Graphics object that was passed in through the PaintEventArgs or, you borked up the Graphics object somehow, or your code took too long to draw, or ... this list goes on and on. Without seeing your drawing code, it's pretty much impossible to pinpoint what went wrong.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      C 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Are you doing any drawing yourself or just relying on the controls to draw themselves?? If your code is taking too long to do anything during a repaint, you can get the Big Red X. If your code is doing custom drawing, then you either didn't use the Graphics object that was passed in through the PaintEventArgs or, you borked up the Graphics object somehow, or your code took too long to draw, or ... this list goes on and on. Without seeing your drawing code, it's pretty much impossible to pinpoint what went wrong.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        C Offline
        C Offline
        cjb110
        wrote on last edited by
        #3

        I think it was a mix of not passing the PaintEventArgs Graphics, and not calling InitaliseComponent() on the child control, which doesn't help!

        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