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