- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
double x, y;
void InitializeComponent()
{
this.MouseClick += new MouseEventHandler(Form1_Click);
this.Paint += new PaintEventHandler(Form1_Paint);
}
void Form1_Paint(object sender, PaintEventArgs e)
{
PointF p = new PointF(0, 0);
PointF pp = new PointF((float)x, (float)y);
e.Graphics.DrawPolygon(new Pen(Color.Black, 3), new PointF[2] { p, pp });
}
void Form1_Click(object sender, MouseEventArgs e)
{
x = e.X;
y = e.Y;
AsyncDraw(ref x, ref y);
}
void AsyncDraw(ref double x, ref double y)
{
x = x;
y = y;
}