private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { if (cur != null) { cur.select(); if (cur is myline) direction = ((myline)cur).getresize(e.X, e.Y); if (direction != action.None) { mode = RESIZE; dx = e.X; dy = e.Y; return; } cur.unselect(); } if (mode == SELECT) { cur = null; myobject mine=null; for (int k = 0; k < obj.Count; k++) { mine = obj[obj.Count - 1 - k]; if (mine is mytext) { if (((mytext)mine).has(e.X, e.Y)) { cur = mine; break; } } else if (mine is mypic) { if (((mypic)mine).has(e.X, e.Y)) { cur = mine; break; } } else if (mine is myoval) { if (((myoval)mine).has(e.X, e.Y)) { cur = mine; break; } } else if (mine is myrect) { if (((myrect)mine).has(e.X, e.Y)) { cur = mine; break; } } else if (mine is myline) { if (((myline)mine).has(e.X, e.Y)) { cur = mine; break; } } } if (cur != null) cur.select(); } myobject tmp = null; if (mode == INSERT) { switch (current) { case SELECT: break; case LINE: tmp = new myline(e.X, e.Y); break; case RECT: tmp = new myrect(e.X, e.Y); break; case OVAL: tmp = new myoval(e.X, e.Y); break; case PIC: tmp = new mypic(e.X, e.Y); if (tmpimage != null) { (tmp as mypic).Image = tmpimage; tmpimage = null; } break; case TEXT: tmp = new mytext(e.X, e.Y); break; } tmp.sethostinfo( pictureBox1,obj); obj.Add(tmp); cur = tmp; } propertyGrid1.SelectedObject = cur; }
private void toolStripButton3_Click(object sender, EventArgs e) { if (mf != null) { foreach (Column c in mf.u) if(c!=null) { mytext mt = new mytext(c.Left, 10); mt.Text = c.Name; mt.reset(c.Width + c.Left, 60); mt.unselect(); obj.Add(mt); } } }