, Win32 ( WM_PAINT) Windows Forms/.NET, draw.
Super simple drawing in .NET! You simply override the OnPaint method and then complete your entire drawing.
You can bind to the paint handler either using the toolbar in Visual Studio, or using the following code in your class;
this.Paint += new System.Windows.Forms.PaintEventHandler(this.MyForm_Paint);
Then you implement the MyForm_Paint method, for example:
private void MyForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = this.CreateGraphics();
Pen p = new Pen(Color.Red, 7);
g.DrawLine(p, 1, 1, 100, 100);
}
source
share