110,566
社区成员
发帖
与我相关
我的任务
分享
//p_main 是panel的名字 是在panel上画的
if (str=="1")
{
Graphics g = e.Graphics;
Pen p = new Pen(Color.Blue, 6);
Pen pe = new Pen(Color.Blue, 6);
pe.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
//One heng
g.DrawLine(p, 190, 80, 240, 80);
// One shu
g.DrawLine(pe, 140, 145, 140, 200);
//Two shu
g.DrawLine(pe, 140, 315, 140, 370);
//Two heng
g.DrawLine(p, 190, 420, 240, 420);
//Long shu
g.DrawLine(p, 237, 80, 237, 420);
// Three heng
g.DrawLine(pe, 239, 250, 300, 250);
g.DrawLine(pe, 555, 145, 555, 200);
g.DrawLine(pe, 555, 315, 555, 370);
g.Dispose();
pe.Dispose();
p.Dispose();
}
else if(str=="2")
{
........
}
button1_click()
{
str="1";
}
button2_click()
{
str="2";
}
private void p_main_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen p = new Pen(Color.Blue, 6);
Pen pe = new Pen(Color.Blue, 6);
pe.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
switch (num)
{
case "0":
//One heng
g.DrawLine(p, 190, 80, 240, 80);
// One shu
g.DrawLine(pe, 140, 145, 140, 200);
//Two shu
g.DrawLine(pe, 140, 315, 140, 370);
//Two heng
g.DrawLine(p, 190, 420, 240, 420);
//Long shu
g.DrawLine(p, 237, 80, 237, 420);
// Three heng
g.DrawLine(pe, 239, 250, 300, 250);
g.DrawLine(pe, 555, 145, 555, 200);
g.DrawLine(pe, 555, 315, 555, 370);
pe.Dispose();
p.Dispose();
break;
case "1":
g.Clear(this.BackColor);
//g.DrawLine(p, 190, 80, 240, 80);
break;
default:
break;
}
}
num = "1"; //程序运行起来后 在这里加断点
Instance_Location("r");
private void Instance_Location(string name_)
{
switch (name_.Trim())
{
case "d":
change_Menu("d");
break;
case "r":
change_Menu("r");
break;
case "h":
this.hetong_add.Location = new System.Drawing.Point(202, 95);
this.hetong_del.Location = new System.Drawing.Point(395, 95);
change_Menu("h");
break;
case "x":
this.xitong_bumen.Location = new System.Drawing.Point(91, 51);
this.xitong_diqu.Location = new System.Drawing.Point(91, 215);
this.xitong_chexing.Location = new System.Drawing.Point(91, 383);
this.xitong_shoufei.Location = new System.Drawing.Point(304, 215);
this.xitong_guanxi.Location = new System.Drawing.Point(506, 51);
this.xitong_quanxian.Location = new System.Drawing.Point(506, 215);
change_Menu("x");
break;
case "":
break;
default:
break;
}
}
private void change_Menu(string name_)
{
foreach (Control p in p_main.Controls)
{
if (p.Name.Substring(0,1) == name_)
{
p.Visible = true;
}
else
{
p.Visible = false;
}
}
System.GC.Collect();
}