using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace anti_virus_pic
{
public class Point_av
{
public int X { get; set; }
public int Y { get; set; }
public Point_av()
{
X = 0;
Y = 0;
}
public Point_av(int val_x, int val_y)
{
X = val_x;
Y = val_y;
}
~Point_av()
{ }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace anti_virus_pic
{
public partial class Form1 : Form
{
private int data_Num = 10;
//private Point_av point_Av_i[0] = new Point_av(200, 150);
private Point_av point_Av_2 = new Point_av(400, 300);
private Point_av point_Av_3 = new Point_av(600, 450);
private Point_av[] point_Av_i = new Point_av[20];//此处定义成类数组,编译未报错。有待进一步考察。暂做记录于此。
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Graphics g = this.CreateGraphics();
//this.Show();
/* this.Show();//此处原书没有,查CSDN得知;未解?
Brush b = new SolidBrush(Color.Pink);
Rectangle rect = new Rectangle(this.ClientRectangle.Width / 2 - 80, this.ClientRectangle.Height / 2 - 80, 160, 160);
Pen p = new Pen(Color.Green);
g.DrawEllipse(p, rect);
g.FillEllipse(b, rect); */
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = this.CreateGraphics();
/* this.Show(); 这些代码都无用,待解?复制粘贴不行,需要在编程环境中添加事件,闪电图标;
Brush b = new SolidBrush(Color.Pink);
Rectangle rect = new Rectangle(this.ClientRectangle.Width / 2 - 80, this.ClientRectangle.Height / 2 - 80, 160, 160);
Pen p = new Pen(Color.Green);
g.DrawEllipse(p, rect);
g.FillEllipse(b, rect);*/
}
private void Form1_Paint_1(object sender, PaintEventArgs e)
{
//复制粘贴不行,需要在编程环境中添加事件,闪电图标;
point_Av_i[0] = new Point_av();//此处引用了数组;
point_Av_i[0].X = 200;
point_Av_i[0].Y = 150;
Graphics g = this.CreateGraphics();
Brush b = new SolidBrush(Color.Red);
Rectangle rect = new Rectangle(point_Av_i[0].X, point_Av_i[0].Y, 8, 8);
Pen p = new Pen(Color.Green);
g.DrawEllipse(p, rect);
g.FillEllipse(b, rect);
g.DrawLine(p, point_Av_i[0].X+4, point_Av_i[0].Y+8, point_Av_i[0].X+4, 800-point_Av_i[0].Y);
rect = new Rectangle(point_Av_2.X, point_Av_2.Y, 8, 8);
g.DrawEllipse(p, rect);
g.FillEllipse(b, rect);
g.DrawLine(p, point_Av_2.X + 4, point_Av_2.Y + 8, point_Av_2.X + 4, 800 - point_Av_2.Y);
rect = new Rectangle(point_Av_3.X, point_Av_3.Y, 8, 8);
g.DrawEllipse(p, rect);
g.FillEllipse(b, rect);
g.DrawLine(p, point_Av_3.X + 4, point_Av_3.Y + 8, point_Av_3.X + 4, 1000 - point_Av_3.Y);
g.DrawLine(p, point_Av_i[0].X + 4, point_Av_i[0].Y + 4, point_Av_2.X + 4, point_Av_2.Y + 4);
g.DrawLine(p, point_Av_2.X + 4, point_Av_2.Y + 4, point_Av_3.X + 4, point_Av_3.Y + 4);
}
}
}