есть класс
public class MyRect : System.Windows.Forms.Panel
{
public MyRect()
: base()
{
this.Paint += new System.Windows.Forms.PaintEventHandler(MyRect_Paint);
}
void MyRect_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Pen p = new Pen(Color.Red);
p.Width = 2;
e.Graphics.DrawRectangle(p, this.Left, this.Top, this.Width, this.Height);
}
}
использую так
MyRect lp = new MyRect();
this.panel1.Controls.Add(lp);
lp.Location = new System.Drawing.Point(10, 10);
lp.Size = new System.Drawing.Size(50, 70);
но почему то отрисовывается только верхняя и левая сторона — двух других не вижу.
в чем дело?
Спасибо.