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. draw above a control?

draw above a control?

Scheduled Pinned Locked Moved C#
questiongraphicshelp
5 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.
  • L Offline
    L Offline
    Longxe
    wrote on last edited by
    #1

    hi, I have a question. I want to draw a line on the panel but this line must be drawn above all the control in this panel. my code doesn't work as my want. protected override void OnPaint(PaintEventArgs e) { base.OnPaint (e); Graphics g = e.Graphics; g.DrawRectangle(new Pen(Color.Red,3),0,0,this.Width-10,this.Height-10); //this rectange still draws under all control } thanks for help!

    C R 2 Replies Last reply
    0
    • L Longxe

      hi, I have a question. I want to draw a line on the panel but this line must be drawn above all the control in this panel. my code doesn't work as my want. protected override void OnPaint(PaintEventArgs e) { base.OnPaint (e); Graphics g = e.Graphics; g.DrawRectangle(new Pen(Color.Red,3),0,0,this.Width-10,this.Height-10); //this rectange still draws under all control } thanks for help!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Any control on your panel will draw above the panel. If this were not so, then you wouldn't be able to see your controls at all. Christian Graus - Microsoft MVP - C++

      L 1 Reply Last reply
      0
      • L Longxe

        hi, I have a question. I want to draw a line on the panel but this line must be drawn above all the control in this panel. my code doesn't work as my want. protected override void OnPaint(PaintEventArgs e) { base.OnPaint (e); Graphics g = e.Graphics; g.DrawRectangle(new Pen(Color.Red,3),0,0,this.Width-10,this.Height-10); //this rectange still draws under all control } thanks for help!

        R Offline
        R Offline
        Rob Graham
        wrote on last edited by
        #3

        Are you doing this in the FORM's on paint, or a control's (what is this)? the co-ordinates you specify should draw the rectangle positionned at the top left of this and 10 pix smaller than the control's size - i.i the top left corner of the rectangle will be at the same point as the top left corner of the control's client area, with it's bottom right corner 10 pix in from this's botoom right corner... Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke

        L 1 Reply Last reply
        0
        • C Christian Graus

          Any control on your panel will draw above the panel. If this were not so, then you wouldn't be able to see your controls at all. Christian Graus - Microsoft MVP - C++

          L Offline
          L Offline
          Longxe
          wrote on last edited by
          #4

          so like you say, how can i put a frame(drawing image) may be this image on another or same panel which :doh:is displaying images that are capturing by webcam. sorry about my bad English! -- modified at 0:16 Wednesday 26th October, 2005

          1 Reply Last reply
          0
          • R Rob Graham

            Are you doing this in the FORM's on paint, or a control's (what is this)? the co-ordinates you specify should draw the rectangle positionned at the top left of this and 10 pix smaller than the control's size - i.i the top left corner of the rectangle will be at the same point as the top left corner of the control's client area, with it's bottom right corner 10 pix in from this's botoom right corner... Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke

            L Offline
            L Offline
            Longxe
            wrote on last edited by
            #5

            my panel still has alot controls and i want this rectangle draw above these controls,and i have just done it buy set the BackColor=Color.Transparency; but while my panel display images capture by webcam, this doesn't qork anymore? Sorry about my bad English! thanks for your 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