}//Draw方法——实体点 public static void Draw(Graphics g, int x, int y, int Width, int Height, Notepoint npt) { //绘制一个注记点图像 Pen point_pen = new Pen(npt.color_out, 1); //画笔 Brush point_brush = new SolidBrush(npt.color_in); //画刷 g.DrawEllipse(point_pen, x - (npt.Size - 1) / 2, y - (npt.Size - 1) / 2, npt.Size, npt.Size); g.FillEllipse(point_brush, x - (npt.Size - 1) / 2, y - (npt.Size - 1) / 2, npt.Size, npt.Size); //填充椭圆 }//Draw方法——注记点
private void button1_Click(object sender, EventArgs e) {//添加点 if (MyGlo.rplist.Count() + MyGlo.nplist.Count < 1 && MyGlo.llist.Count == 0) { MessageBox.Show("请先输入图像"); } else { try { if (this.radioButton1.Checked == true) { Realpoint rpt = new Realpoint( textBox1.Text + "," + textBox2.Text + "," + textBox3.Text + "," + textBox4.Text + " " + textBox5.Text + " " + textBox6.Text + " " + textBox7.Text + " " + textBox8.Text ); MyGlo.rplist.Add(rpt); this.Owner.Refresh(); } if (this.radioButton2.Checked == true) { Notepoint npt = new Notepoint( textBox1.Text + "," + textBox2.Text + "," + textBox3.Text + "," + textBox5.Text + " " + textBox6.Text + " " + textBox7.Text + " " + textBox8.Text ); MyGlo.nplist.Add(npt); this.Owner.Refresh(); } } catch { MessageBox.Show("请核对信息是否正确"); } } }
}//DataType方法,判断导入数据类型 public static void Importfile(StreamReader f, Graphics g, int Height, int Width) { while (f.Peek() > -1) //判断文件有没有读取完 { string tmp = f.ReadLine(); //读取第一行信息 switch (Funcs.DataType(tmp)) //根据数据类型绘制 { case 1: //为实体点 { string temp = f.ReadLine(); //再读一行字符串,判断是否为空,不为空就录入 while (temp != null && temp != ",,,") { //实例化实体点并加入实体点集 Realpoint realpoint = new Realpoint(temp); MyGlo.rplist.Add(realpoint); temp = f.ReadLine(); } //while } //case 1 break; case 2: //为注记点 { string temp = f.ReadLine(); while (temp != null && temp != ",,,") { Notepoint notepoint = new Notepoint(temp); MyGlo.nplist.Add(notepoint); temp = f.ReadLine(); } } //case 2 break; case 3: //为常规线 { string temp = f.ReadLine(); List <Basepoint> bt_temp = new List <Basepoint>(); while (temp != null && temp != ",,,") { Linkpoint linkpoint = new Linkpoint(temp); bt_temp.Add(linkpoint); temp = f.ReadLine(); } Lineshape lineshape = new Lineshape(bt_temp, tmp); //实例化线对象 MyGlo.llist.Add(lineshape); //加入列表 } //case3 break; case 4: //为弧线 { string temp = f.ReadLine(); List <Basepoint> bt_temp = new List <Basepoint>(); while (temp != null && temp != ",,,") { Linkpoint linkpoint = new Linkpoint(temp); bt_temp.Add(linkpoint); temp = f.ReadLine(); } Lineshape lineshape = new Lineshape(bt_temp, tmp); MyGlo.llist.Add(lineshape); } break; //case4 case 5: { string temp = f.ReadLine(); List <Basepoint> bt_temp = new List <Basepoint>(); while (temp != null && temp != ",,,") { Linkpoint linkpoint = new Linkpoint(temp); bt_temp.Add(linkpoint); temp = f.ReadLine(); } Lineshape lineshape = new Lineshape(bt_temp, tmp); MyGlo.llist.Add(lineshape); } break; //case5 case 6: { string temp = f.ReadLine(); List <Basepoint> bt_temp = new List <Basepoint>(); while (temp != null && temp != ",,,") { Linkpoint linkpoint = new Linkpoint(temp); bt_temp.Add(linkpoint); temp = f.ReadLine(); } Lineshape lineshape = new Lineshape(bt_temp, tmp); MyGlo.llist.Add(lineshape); } break; //case6 }//switch Funcs.Update(g, Width, Height); }//while } //importfile,导入roi