private void toolStripMenuItem9_Click(object sender, EventArgs e) { if (UI.Handler == null) { return; } var f = new ClipForm(); f.txtCode.Text = UI.Handler.UndoManager.GetHistory(); f.ShowDialog(); }
private void ClipMaster_Click(object sender, EventArgs e) { ClipForm cf = null; cf = new ClipForm(); cf.SizeChanged += Form_SizeChanged; cf.FormClosed += (fcSender, fcE) => { Show(); }; cf.Show(); Hide(); }
/// <summary> /// mapControl鼠标放开事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void m_mapControl_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e) { switch (e.button) { case 1: //左键 m_mapControl.Focus(); //执行裁剪,自定义包络线 this.Capture = false; System.Windows.Forms.Cursor.Clip = Rectangle.Empty; MouseIsDown = false; DrawRectangle(); MouseRect = Rectangle.Empty; //遍历当前所有已打开的窗口,查找clipform if (drawflag != "") { foreach (XtraForm form in Application.OpenForms) //遍历所有窗口,查找对应的clip窗口 { if (form is ClipForm) { ClipForm clipform = form as ClipForm; if (clipform.Tag.ToString() == drawflag) //根据窗口tag值,即窗口handle,将坐标传回该clip窗口 { (clipform.getrightbottomX()).Text = e.mapX.ToString(); (clipform.getrightbottomY()).Text = e.mapY.ToString(); clipform.Focus(); clipform.Refresh(); break; } } } } drawflag = ""; break; case 2: //右键 break; case 3: break; case 4: //中键 break; } }
/// <summary> /// mapControl鼠标按下事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void m_mapControl_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e) { switch (e.button) { case 1: // 鼠标左键 if (drawflag != "") { MouseIsDown = true; DrawStart(e.x + m_tocControl.Size.Width + 20, e.y + ribbonMenu.Size.Height + 35); foreach (XtraForm form in Application.OpenForms) //遍历所有窗口,查找对应的clip窗口 { if (form is ClipForm) { ClipForm clipform = form as ClipForm; if (clipform.Tag.ToString() == drawflag) //根据窗口tag值,即窗口handle,将坐标传回该clip窗口 { (clipform.getlefttopX()).Text = e.mapX.ToString(); (clipform.getlefttopY()).Text = e.mapY.ToString(); break; } } } } else { if (drawSampleflag == 1) { trackPolyonState = 1; //产生拖拽多边形 IGeometry SampleGeometry = m_mapControl.TrackPolygon(); if (SampleGeometry != null) { //触发事件,激活监督分类窗口 if (CreateSample != null) { CreateSample(SampleGeometry); } } } } break; case 2: // 鼠标右键 mapControl_contextMenuStrip.Show(m_mapControl, new System.Drawing.Point(e.x, e.y)); break; case 3: break; case 4: // 鼠标中键 m_mapControl.MousePointer = esriControlsMousePointer.esriPointerPan; m_mapControl.Pan(); //判断事件并恢复光标 if (drawSampleflag == 1) { //之前处于绘制多边形状态,将光标恢复至十字形 m_mapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair; } else { m_mapControl.MousePointer = esriControlsMousePointer.esriPointerArrow; } break; } }
/// <summary> /// 裁剪图层 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void iClip_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ClipForm clip = new ClipForm(this); clip.Show(); }