protected override void OnMouseDown(MouseEventArgs e) { Point locate = new Point( e.X + HorizontalScroll.Value, e.Y + VerticalScroll.Value); if (e.Button == MouseButtons.Left) { clickedItem = GetItemAtPoint(locate); if (clickedItem != null) { if (clickedItem is CustomItemNode) { if (!drawingLine) { clickedItemPoint = new Point( locate.X - clickedItem.ItemLocate.X, locate.Y - clickedItem.ItemLocate.Y); } else { if (!(clickedItem is ItemEnd)) { currentDrawingLine = CreateWorkFlowLine(); currentDrawingLine.ItemStatus = ItemStatus.Drawing; currentDrawingLine.ItemFrom = clickedItem as CustomItemNode; } } } } } base.OnMouseDown(e); }
protected override void OnMouseMove(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (!m_drawingLink) { if (m_ClickedItem != null) { m_ClickedItem.ItemLocate = new Point(e.Location.X - m_PointInItem.X, e.Location.Y - m_PointInItem.Y); Refresh(); } } } else { m_ClickedItem = GetItemAtPoint(e.Location); if (m_ClickedItem != null) { m_ClickedItem.ItemStatus = ItemStatus.Pointed; } else { foreach (IPaintItem item in m_painttiems) { item.ItemStatus = ItemStatus.Watting; } } this.Refresh(); } }
protected override void OnMouseUp(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { m_ClickedItem = null; } base.OnMouseUp(e); }
private void paintPanle1_MouseDoubleClick(object sender, MouseEventArgs e) { IPaintItem item = this.paintPanle1.GetItemAtPoint(e.Location); if (item != null && item is PaintUnit) { string itemname = Microsoft.VisualBasic.Interaction.InputBox("请输入新名称", "提示", "未命名", 100, 100); item.ItemName = itemname; } }
void panel1_MouseDoubleClick(object sender, MouseEventArgs e) { IPaintItem item = this.panel1.GetItemAtPoint(e.Location); SearchSetting set = new SearchSetting(); set.ShowDialog(); //strList.Add(set.searchProperty); strList = set.searchProperty; item.doubleClickCheck = true; }
protected override void OnMouseDown(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { w_ClickedItem = GetItemAtPoint(e.Location); if (w_ClickedItem != null) { w_pointInItem = new Point(e.X - w_ClickedItem.itemLocation.X, e.Y - w_ClickedItem.itemLocation.Y); } } base.OnMouseDown(e); }
private void panle1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (tsButton3.Checked && (w_currentItem != null && w_currentItem is DrawLine)) { IPaintItem selectedunit = this.panel1.GetItemAtPoint(e.Location); if (selectedunit != null && selectedunit is PaintUnit) { ((DrawLine)w_currentItem).EndPoint = (PaintUnit)selectedunit; if (((DrawLine)w_currentItem).EndPoint.itemLocation == ((DrawLine)w_currentItem).StartPoint.itemLocation) { MessageBox.Show("Please chose another end point!", "OOPs"); } else { this.panel1.PaintItems.Add(w_currentItem); wCount++; wDigital++; } } this.tsButton3.Checked = false; w_currentItem = null; } if (tsButton4.Checked && (w_currentItem != null && w_currentItem is CallBackLine)) { IPaintItem selectedunit = this.panel1.GetItemAtPoint(e.Location); if (selectedunit != null && selectedunit is PaintUnit) { ((CallBackLine)w_currentItem).EndPoint = (PaintUnit)selectedunit; if (((CallBackLine)w_currentItem).EndPoint.itemLocation == ((CallBackLine)w_currentItem).StartPoint.itemLocation) { MessageBox.Show("Please chose another end point!", "OOPs"); selectedunit.status = false; } //if(((CallBackLine)w_currentItem).ArrPoints[2] == ((CallBackLine)w_currentItem).ArrPoints[0]) else { this.panel1.PaintItems.Add(w_currentItem); wCount++; } } else { ((CallBackLine)w_currentItem).StartPoint.status = false; } this.tsButton4.Checked = false; w_currentItem = null; } panel1.DrawLine = false; } this.panel1.Refresh(); }
private void paintPanle1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { IPaintItem selectedunit = this.paintPanle1.GetItemAtPoint(e.Location); if (selectedunit != null && selectedunit is PaintUnit) { if (toolStripButton4.Checked) { PaintLink link = new PaintLink("", ItemStatus.Actived, e.Location, new Pen(Color.Black), this.Font); link.StartPoint = (PaintUnit)selectedunit; m_currentitem = link; paintPanle1.DrawingLink = true; } } } }
protected override void OnMouseUp(MouseEventArgs e) { Point location = new Point( e.X + HorizontalScroll.Value, e.Y + VerticalScroll.Value); if (e.Button == MouseButtons.Left) { if (drawingLine) { if (currentDrawingLine != null) { IPaintItem item = GetItemAtPoint(location); if (item != null && item is CustomItemNode) { if (item == currentDrawingLine.ItemFrom) { } else if (item is ItemBegin) { } else { if (CheckValid( currentDrawingLine, item as CustomItemNode)) { currentDrawingLine.ItemStatus = ItemStatus.Watting; currentDrawingLine.ItemTo = item as CustomItemNode; if (!LinkLineExists(currentDrawingLine)) { currentDrawingLine.ItemTo.PrevLinks.Add(currentDrawingLine); currentDrawingLine.ItemFrom.NextLinks.Add(currentDrawingLine); } } } } currentDrawingLine = null; } } } base.OnMouseUp(e); }
private void paintPanle1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (toolStripButton4.Checked && (m_currentitem != null && m_currentitem is PaintLink)) { IPaintItem selectedunit = this.paintPanle1.GetItemAtPoint(e.Location); if (selectedunit != null && selectedunit is PaintUnit) { ((PaintLink)m_currentitem).EndPoint = (PaintUnit)selectedunit; ((PaintLink)m_currentitem).ItemStatus = ItemStatus.Finished; this.paintPanle1.PaintItems.Add(m_currentitem); } this.toolStripButton4.Checked = false; m_currentitem = null; } paintPanle1.DrawingLink = false; } }
private void panel1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { foreach (IPaintItem item in this.panel1.PaintItems) { item.selectStatus = false; } IPaintItem selectedUnit = this.panel1.GetItemAtPoint(e.Location); if (selectedUnit != null && selectedUnit is PaintUnit) { if (tsButton3.Checked) { DrawLine line = new DrawLine("line" + wCount.ToString(), e.Location, new Pen(Color.Black, 10), this.Font, wDigital); line.StartPoint = (PaintUnit)selectedUnit; line.StartPoint.itemLocation = ((PaintUnit)selectedUnit).itemLocation; w_currentItem = line; panel1.DrawLine = true; } else if (tsButton4.Checked) { CallBackLine curve = new CallBackLine("line" + wCount.ToString(), e.Location, new Pen(Color.Black, 10), this.Font); curve.StartPoint = (PaintUnit)selectedUnit; if (selectedUnit.status) { MessageBox.Show("This task has already CallBack once and can't CallBack again.\nPlease find another solution!", "You are in TROUBLE!"); } else { selectedUnit.status = true; w_currentItem = curve; panel1.DrawLine = true; } } else { selectedUnit.selectStatus = true; } } } }
protected override void OnMouseDown(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { m_ClickedItem = GetItemAtPoint(e.Location); if (m_ClickedItem != null) { m_PointInItem = new Point(e.X - m_ClickedItem.ItemLocate.X, e.Y - m_ClickedItem.ItemLocate.Y); } } base.OnMouseDown(e); }
private void paintPanle1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { IPaintItem selectedunit = this.paintPanle1.GetItemAtPoint(e.Location) ; if(selectedunit != null && selectedunit is PaintUnit ) { if (toolStripButton4.Checked) { PaintLink link = new PaintLink("", ItemStatus.Actived, e.Location, new Pen(Color.Black), this.Font); link.StartPoint = (PaintUnit)selectedunit; m_currentitem = link; paintPanle1.DrawingLink = true; } } } }
protected override void OnMouseMove(MouseEventArgs e) { Point location = new Point( e.X + HorizontalScroll.Value, e.Y + VerticalScroll.Value); if (e.Button == MouseButtons.Left) { if (!drawingLine) { if (clickedItem != null) { clickedItem.ItemLocate = new Point( location.X - clickedItemPoint.X, location.Y - clickedItemPoint.Y); Refresh(); } } else { IPaintItem item = GetItemAtPoint(location); if (currentDrawingLine != null) { // 连接线已经存在,则将连接线的终点设置到当前鼠标所在的坐标。 // 如果鼠标所在位置是结点,则设置终点为结点的 LinkToPrevPoint if (item != null && item is CustomItemNode) { if (item != currentDrawingLine.ItemFrom) { currentDrawingLine.EndPoint = ((CustomItemNode)item).ToPoint; } else { currentDrawingLine.EndPoint = location; } } else { currentDrawingLine.EndPoint = location; } Refresh(); } } } else { IPaintItem itemMouseStay = GetItemAtPoint(location); if (itemMouseStay == null) { IPaintItem line = GetLineAtPoint(location); if (line != null) { if (lastMouseStayItem == null) { lastMouseStayItem = line; line.ItemStatus = ItemStatus.Pointed; Refresh(); } else { if (lastMouseStayItem != line) { lastMouseStayItem.ItemStatus = ItemStatus.Watting; line.ItemStatus = ItemStatus.Pointed; lastMouseStayItem = line; Refresh(); } } } else { if (lastMouseStayItem != null) { lastMouseStayItem.ItemStatus = ItemStatus.Watting; lastMouseStayItem = null; Refresh(); } } } else { if (lastMouseStayItem == null) { lastMouseStayItem = itemMouseStay; lastMouseStayItem.ItemStatus = ItemStatus.Pointed; Refresh(); } else { if (lastMouseStayItem != itemMouseStay) { lastMouseStayItem.ItemStatus = ItemStatus.Watting; itemMouseStay.ItemStatus = ItemStatus.Pointed; lastMouseStayItem = itemMouseStay; Refresh(); } } } } base.OnMouseMove(e); }