U
Umut Tezduyar
I want to make custom control. The problem is, i want to inherit from
System.Windows.Forms.Control class not System.Windows.Forms.CustomControl.
Although i have overriden the method OnPaint in my class and draw something
inside it, it doesnt draw in the main form that i add my custom control.
public class MyCustomControl : System.Windows.Forms.Control
{
protected override void OnPaint (PaintEventArgs e)
{
base.OnPaint (e);
e.Graphics.DrawRectangle (new
System.Drawing.Pen(System.Drawing.Color.Red,2),0,0,this.Width,this.Height);
}
}
It doesnt enter the OnPaint method. But if i change the base class to
UserControl, it draws my custom control. Can anyone explain this to me,
please..
System.Windows.Forms.Control class not System.Windows.Forms.CustomControl.
Although i have overriden the method OnPaint in my class and draw something
inside it, it doesnt draw in the main form that i add my custom control.
public class MyCustomControl : System.Windows.Forms.Control
{
protected override void OnPaint (PaintEventArgs e)
{
base.OnPaint (e);
e.Graphics.DrawRectangle (new
System.Drawing.Pen(System.Drawing.Color.Red,2),0,0,this.Width,this.Height);
}
}
It doesnt enter the OnPaint method. But if i change the base class to
UserControl, it draws my custom control. Can anyone explain this to me,
please..