为什么每次调试进入Form1_Paint()都要执行两遍才会出现form框架。然后form就迅速最小化在调出来点也没什么反映。就一直反复做这个函数
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
point[i].X = e.X;
point[i].Y = e.Y;
if (i < N)
{
rb[i] = new RadioButton();
rb[i].Location = point[i];
this.Controls.Add(rb[i]);
}
i++;
//this.Refresh();
} private void Form1_Paint(object sender, PaintEventArgs e)
{
int k=0;
j = 0;
gg = e.Graphics; //创建画板,这里的画板是由Form提供的.
////SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);//画刷
p.DashStyle = DashStyle.Solid; //定义实线
p.EndCap = LineCap.ArrowAnchor; //定义线尾的样式为箭头
while (k < N)
{
//gg.FillEllipse(myBrush, new Rectangle(point[j].X, point[j].Y, 10, 10));//画实心椭圆
gg.DrawLine(p, point_edge[j].X, point_edge[j].Y, point_edge[j+1].X, point_edge[j+1].Y);
j++;
k++;
}
} private void button1_Click(object sender, EventArgs e)
{
int k = 0;
foreach(RadioButton rabu in rb)
{
if (rabu.Checked)
{
point_edge[k] = rabu.Location;
k++;
}
}
WinForm调试
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
point[i].X = e.X;
point[i].Y = e.Y;
if (i < N)
{
rb[i] = new RadioButton();
rb[i].Location = point[i];
this.Controls.Add(rb[i]);
}
i++;
//this.Refresh();
} private void Form1_Paint(object sender, PaintEventArgs e)
{
int k=0;
j = 0;
gg = e.Graphics; //创建画板,这里的画板是由Form提供的.
////SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);//画刷
p.DashStyle = DashStyle.Solid; //定义实线
p.EndCap = LineCap.ArrowAnchor; //定义线尾的样式为箭头
while (k < N)
{
//gg.FillEllipse(myBrush, new Rectangle(point[j].X, point[j].Y, 10, 10));//画实心椭圆
gg.DrawLine(p, point_edge[j].X, point_edge[j].Y, point_edge[j+1].X, point_edge[j+1].Y);
j++;
k++;
}
} private void button1_Click(object sender, EventArgs e)
{
int k = 0;
foreach(RadioButton rabu in rb)
{
if (rabu.Checked)
{
point_edge[k] = rabu.Location;
k++;
}
}
WinForm调试
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货