private void DrawPanelMouseDown(object sender, MouseEventArgs e) { _MousePosition = new Point(e.X, e.Y); HitLocation hl = _DrawPanel.HitNode(_MousePosition, PointsX(_hScroll.Value), PointsY(_vScroll.Value)); _MouseDownNode = hl == null? null: hl.HitNode; _MouseDownLoc = hl == null? HitLocationEnum.Inside: hl.HitSpot; if (DrawPanelMouseDownInsert(hl, sender, e)) // Handle ReportItem insertion return; if (e.Button == MouseButtons.Left) _Undo.StartUndoGroup("Move/Size"); if (DrawPanelMouseDownRubberBand(sender, e)) // Handle rubber banding return; if (DrawPanelMouseDownTableColumnResize(sender, e)) // Handle column resize return; if (DrawPanelMouseDownTableRowResize(sender, e)) // Handle row resize return; if (_MouseDownNode.Name == "Height") { _DrawPanel.ClearSelected(); SelectionChanged(this, new EventArgs()); HeightChanged(this, new HeightEventArgs(_MouseDownNode, _MouseDownNode.InnerText)); // Set the height } else if ((Control.ModifierKeys & Keys.Control) == Keys.Control) { _DrawPanel.AddRemoveSelection(_MouseDownNode); SelectionChanged(this, new EventArgs()); } else { _DrawPanel.SetSelection(_MouseDownNode, true); SelectionChanged(this, new EventArgs()); } DrawPanelSetCursor(_MouseDownNode, hl.HitSpot); }
private void DrawPanelSetCursor(XmlNode node, HitLocationEnum hle) { Cursor c; if (node == null) c = Cursors.Arrow; else if (node.Name == "Height") c = Cursors.SizeNS; else if (hle == HitLocationEnum.TableColumnResize) // doesn't need to be selected c = Cursors.VSplit; else if (hle == HitLocationEnum.TableRowResize) // doesn't need to be selected c = Cursors.HSplit; else if (this._DrawPanel.IsNodeSelected(node)) { switch (hle) { case HitLocationEnum.BottomLeft: case HitLocationEnum.TopRight: c = Cursors.SizeNESW; break; case HitLocationEnum.LeftMiddle: case HitLocationEnum.RightMiddle: c = Cursors.SizeWE; break; case HitLocationEnum.BottomRight: case HitLocationEnum.TopLeft: c = Cursors.SizeNWSE; break; case HitLocationEnum.TopMiddle: case HitLocationEnum.BottomMiddle: c = Cursors.SizeNS; break; case HitLocationEnum.Move: c = Cursors.SizeAll; break; case HitLocationEnum.TableColumnResize: c = Cursors.VSplit; break; case HitLocationEnum.TableRowResize: c = Cursors.HSplit; break; case HitLocationEnum.LineLeft: case HitLocationEnum.LineRight: // c = Cursors.Cross; bug in C# runtime? Cross doesn't work! c = Cursors.Hand; break; case HitLocationEnum.Inside: default: c = Cursors.Arrow; break; } } else c = Cursors.Arrow; if (c != this.Cursor) this.Cursor = c; }
private void DrawPanelMouseDown(object sender, MouseEventArgs e) { bool baseOnly = false; //Josh: Added so base form can be force selected for inserting/selecting //Hold shift to select the base form instead of the control the mouse is over. if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { baseOnly = true; } _MousePosition = new Point(e.X, e.Y); HitLocation hl = _DrawPanel.HitNode(_MousePosition, PointsX(_hScroll.Value), PointsY(_vScroll.Value), baseOnly); _MouseDownNode = hl == null? null: hl.HitNode; _MouseDownLoc = hl == null? HitLocationEnum.Inside: hl.HitSpot; if (DrawPanelMouseDownInsert(hl, sender, e)) // Handle ReportItem insertion return; if (e.Button == MouseButtons.Left) _Undo.StartUndoGroup(Strings.DesignCtl_Undo_Move_Size); if (DrawPanelMouseDownRubberBand(sender, e)) // Handle rubber banding return; if (DrawPanelMouseDownTableColumnResize(sender, e)) // Handle column resize return; if (DrawPanelMouseDownTableRowResize(sender, e)) // Handle row resize return; if (_MouseDownNode.Name == "Height") { _DrawPanel.ClearSelected(); SelectionChanged(this, new EventArgs()); HeightChanged(this, new HeightEventArgs(_MouseDownNode, _MouseDownNode.InnerText)); // Set the height } else if ((Control.ModifierKeys & Keys.Control) == Keys.Control) { _DrawPanel.AddRemoveSelection(_MouseDownNode); SelectionChanged(this, new EventArgs()); } else { _DrawPanel.SetSelection(_MouseDownNode, true); SelectionChanged(this, new EventArgs()); } DrawPanelSetCursor(_MouseDownNode, hl.HitSpot); }