Form.Paint : Form « System.Windows.Forms « C# / C Sharp by API






Form.Paint

    
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class DrawLineDemo : System.Windows.Forms.Form
{
  public DrawLineDemo()
  {
    this.BackColor = System.Drawing.Color.White;
    this.ClientSize = new System.Drawing.Size(400, 400);
    this.Paint += new System.Windows.Forms.PaintEventHandler(this.DrawLineDemo_Paint);

  }
  static void Main() 
  {
    Application.Run(new DrawLineDemo());
  }

  private void DrawLineDemo_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
    Graphics g = e.Graphics;
    Pen p = new Pen(Color.Black, 10);
    g.DrawLine(p, 25, 25, 375, 375);
  }
}

   
    
    
    
  








Related examples in the same category

1.new Form()
2.extends Form
3.Form.AcceptButton
4.Form.ActiveForm.Location
5.Form.Activated
6.Form.AddOwnedForm
7.Form.AutoScaleBaseSize
8.Form.AutoScroll
9.Form.AutoScrollMinSize
10.Form.BackColor
11.Form.CancelButton
12.Form.CenterToScreen()
13.Form.ClientRectangle
14.Form.ClientSize
15.Form.Closed
16.Form.Closing
17.Form.ContextMenu
18.Form.ControlBox
19.Form.Controls
20.Form.Cursor
21.Form.DesktopBounds
22.Form.DialogResult
23.Form.DisplayRectangle
24.Form.Dispose
25.Form.FormBorderStyle
26.Form.ForeColor
27.Form.GotFocus
28.Form.Height
29.Form.Hide()
30.Form.Invalidate
31.Form.IsMdiContainer
32.Form.KeyPress
33.Form.KeyPreview
34.Form.KeyUp
35.Form.Load
36.Form.Location
37.Form.MaximizeBox
38.Form.MaximumSize
39.Form.MdiParent
40.Form.MenuComplete
41.Form.Menu
42.Form.MinimizeBox
43.Form.MinimumSize
44.Form.MouseDown
45.Form.MouseLeave(All other events)
46.Form.MouseUp
47.Form.OnDragDrop
48.Form.OnDragOver
49.Form.OnInputLanguageChanged
50.Form.OnKeyDown
51.Form.OnKeyPress
52.Form.OnMouseEnter
53.Form.OnMouseHover
54.Form.OnMouseLeave
55.Form.OnMouseMove
56.Form.OnMouseWheel
57.Form.OnPaint(PaintEventArgs e)
58.Form.OnResize
59.Form.Opacity
60.Form.Region
61.Form.Resize
62.Form.ResizeRedraw
63.Form.SetStyle
64.Form.ShowInTaskbar
65.Form.Size
66.Form.Show
67.Form.StartPosition
68.Form.SuspendLayout
69.Form.Text
70.Form.Top
71.Form.TransparencyKey
72.Form.Visible
73.Form.Width
74.Form.WindowState