public override void OnMouseDown(DUIMouseEventArgs e) { base.OnMouseDown(e); if (e.Button == MouseButtons.Left) { //contextMenuStrip.Tag = this; if (contextMenuStrip.Visible) { contextMenuStrip.Hide(); } else { ToolStripMenuItem toolStripMenuItem = (lastToolStripItem as ToolStripMenuItem); if (toolStripMenuItem == null) { return; } contextMenuStrip.Tag = toolStripMenuItem; if (toolStripMenuItem.DropDownItems.Count == 0) { return; } while (toolStripMenuItem.DropDownItems.Count > 0) { contextMenuStrip.Items.Add(toolStripMenuItem.DropDownItems[0]); } Rectangle tsiBounds = GetBounds(toolStripMenuItem); contextMenuStrip.Show(Point.Ceiling(this.PointToScreen(new PointF(tsiBounds.X, this.Height)))); } } }
internal override void DoMouseDown(DUIMouseEventArgs e) { if (!this.Visible || !this.Enabled) { return; } DUIControl dUIControl = this.GetChildAtPoint(e.Location); if (dUIControl == null) { #region 重写的部分,只有在多边形区域内的时候才判定为设置焦点 if (this.ContainPoint(e.Location) || this.GetPolygonPointIndex(e.Location) != -1) { this.Focus(); } else { if (this.DUIParent != null) { this.DUIParent.Focus(); } } #endregion this.AlwaysMouseDown(this, e); this.InvokeOnMouseDown(this, e); } else { dUIControl.DoMouseDown(new DUIMouseEventArgs(e.Button, e.Clicks, dUIControl.PointFromParent(e.Location), e.Delta)); } }
public override void OnMouseUp(DUIMouseEventArgs e) { base.OnMouseUp(e); if (!this.ContainPoint(e.Location)) { this.Cursor = Cursors.Default; } }
public override void OnMouseMove(DUIMouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { this.editableControl.SetCenterChanging(this.ThisCenter); } base.OnMouseMove(e); }
public override void OnMouseDown(DUIMouseEventArgs e) { if (this.BodyRectangle.Contains(e.Location)) { this.mouseEffectScrollPoint = new PointF(e.Location.X - BodyRectangle.X, e.Location.Y); this.isMouseDownInScroll = true; } base.OnMouseDown(e); }
public override void OnMouseDown(DUIMouseEventArgs e) { this.mouseDownPolygon = this.polygon; if (hoverPointIndex != -1) { this.LimitPolygonPointY = this.polygon[this.hoverPointIndex].Y; this.LimitPolygonPointX = this.polygon[this.hoverPointIndex].X; } base.OnMouseDown(e); }
public override void OnMouseDown(DUIMouseEventArgs e) { base.OnMouseDown(e); DUITabPage tabPage = this.owner.TabPages.OfType <DUITabPage>().FirstOrDefault(t => new RectangleF(t.TitleX, t.TitleY, this.owner.TabTitleSize.Width, this.owner.TabTitleSize.Height).Contains(e.Location)); if (tabPage != null) { this.owner.SelectPage(tabPage); } }
public override void OnMouseMove(DUIMouseEventArgs e) { base.OnMouseMove(e); if (e.Button == System.Windows.Forms.MouseButtons.Left) { this.editableControl.SetCenterChanging(this.ThisCenter); } this.mouseMovePoint = e.Location; this.Invalidate(); }
public override void OnMouseWheel(DUIMouseEventArgs e) { base.OnMouseWheel(e); if (e.Delta < 0) { if (this.LeftToRight) { if (this.sliderBody.X - this.sliderBody.ChangeStepX < this.sliderBody.LeftMargin) { this.sliderBody.X = (float)this.sliderBody.LeftMargin; } else { this.sliderBody.X -= this.sliderBody.ChangeStepX; } } else { if (this.sliderBody.Bottom + this.sliderBody.ChangeStepY > this.sliderBody.BottomMargin) { this.sliderBody.Y = (float)this.sliderBody.BottomMargin - this.sliderBody.Height; } else { this.sliderBody.Y += this.sliderBody.ChangeStepY; } } } else { if (this.LeftToRight) { if (this.sliderBody.Right + this.sliderBody.ChangeStepX > this.sliderBody.RightMargin) { this.sliderBody.X = (float)this.sliderBody.RightMargin - this.sliderBody.Width; } else { this.sliderBody.X += this.sliderBody.ChangeStepX; } } else { if (this.sliderBody.Y - this.sliderBody.ChangeStepY < this.sliderBody.TopMargin) { this.sliderBody.Y = (float)this.sliderBody.TopMargin; } else { this.sliderBody.Y -= this.sliderBody.ChangeStepY; } } } }
public override void OnMouseDown(DUIMouseEventArgs e) { base.OnMouseDown(e); if (this.editableControl != null) { this.editableControl.mouseDownBounds = new RectangleF(this.editableControl.x, this.editableControl.y, this.editableControl.width, this.editableControl.height); this.editableControl.mouseDownCenter = new PointF(this.editableControl.centerX, this.editableControl.centerY); this.editableControl.mouseDownScale = new PointF(this.editableControl.scaleX, this.editableControl.scaleY); this.editableControl.mouseDownSkew = new PointF(this.editableControl.skewX, this.editableControl.skewY); this.editableControl.mouseDownRotateAngle = this.editableControl.rotate; } }
public override void OnMouseUp(DUIMouseEventArgs e) { base.OnMouseUp(e); if (this.ClientRectangle.Contains(e.Location)) { CheckStateIndex++; if (CheckStateIndex > this.CheckStates.Count - 1) { CheckStateIndex = 0; } SetCheckState(); } }
public override void OnMouseMove(DUIMouseEventArgs e) { if (isMouseDownInScroll) { if (e.Button == MouseButtons.Left) { float oldValue = this.Value; this.Value = (e.Location.X - this.mouseEffectScrollPoint.X) * this.Maximum / this.ClientRectangle.Width; DUIScrollEventArgs se = new DUIScrollEventArgs(ScrollEventType.SmallDecrement, oldValue, this.Value, ScrollOrientation.HorizontalScroll); OnScroll(se); } //this.Invalidate(); } base.OnMouseMove(e); }
public override void OnMouseMove(DUIMouseEventArgs e) { PointF location = e.Location; if (e.Button == MouseButtons.None) { int newHoverPointIndex = this.GetPolygonPointIndex(e.Location); if (this.hoverPointIndex != newHoverPointIndex) { this.hoverPointIndex = newHoverPointIndex; this.Invalidate(); } } base.OnMouseMove(e); }
public override void OnMouseMove(DUIMouseEventArgs e) { base.OnMouseMove(e); #region 标拖动画布 if (ArrowMouseDragCanvas && this.isArrowMouseDragCanvasMouseDown) { PointF p = CanvasToPoint(e.Location); this.Cursor = Cursors.SizeAll; this.CenterX += p.X - lastMousePoint.X; this.CenterY += p.Y - lastMousePoint.Y; lastMousePoint = p; this.Invalidate(); //位置变化时刷新 } #endregion }
public override void OnMouseMove(DUIMouseEventArgs e) { base.OnMouseMove(e); foreach (ToolStripItem tsi in this.Items) { if (tsi.Enabled) { Rectangle tsiBounds = GetBounds(tsi); if (isMouseEnter && tsiBounds.Contains(Point.Ceiling(this.PointToClient(DUIControl.MousePosition))) && lastToolStripItem != tsi) { lastToolStripItem = tsi; this.Invalidate(); } } } }
public override void OnMouseDown(DUIMouseEventArgs e) { base.OnMouseDown(e); if (this.LeftToRight) { float x = e.X - this.sliderBody.Width / 2; this.sliderBody.X = x - x % this.sliderBody.ChangeStepX; } else { float y = e.Y - this.sliderBody.Height / 2; this.sliderBody.Y = y - y % this.sliderBody.ChangeStepY; } this.sliderBody.PerformMouseDown(new DUIMouseEventArgs(e.Button, e.Clicks, new PointF(this.sliderBody.Width / 2, this.sliderBody.Height / 2), e.Delta)); this.PerformMouseUp(new DUIMouseEventArgs(e.Button, e.Clicks, e.Location, e.Delta)); }
internal override void DoMouseWheel(DUIMouseEventArgs e) { if (this.DUIControlShare.FocusedDUIControl == null) { return; } if (this.AnyFocused) { #region 缩放画布 if (this.ArrowScaleCanvas) { #region 当前的距离差除以缩放比还原到未缩放长度 这里将画布比例按照当前缩放比还原到没有缩放的状态 float tempX = Center.X - e.Location.X; float tempY = Center.Y - e.Location.Y; #endregion float currentScaling = Scaling; //保存当前的缩放比 Scaling += e.Delta > 0 ? this.scalePrecision : -this.scalePrecision; //还原上一次的偏移 this.CenterX -= tempX * (1 - Scaling); this.CenterY -= tempY * (1 - Scaling); //重新计算缩放并重置画布原点坐标 this.CenterX += tempX / currentScaling * Scaling - (this.Center.X - e.Location.X); this.CenterY += tempY / currentScaling * Scaling - (this.Center.Y - e.Location.Y); this.Invalidate(); } #endregion this.OnMouseWheel(e); } else { this.DUIControls.OfType <DUIControl>().Where(d => d.Visible).ToList().ForEach(d => { d.DoMouseWheel(new DUIMouseEventArgs(e.Button, e.Clicks, d.PointFromParent(e.Location), e.Delta)); if (d.AnyFocused && d.CanMouseThrough) { this.OnMouseWheel(e); } }); } }
internal override void DoMouseUp(DUIMouseEventArgs e) { var mouseDownDUIControls = this.DUIControlShare.MouseDownDUIControls.Where(c => c.Button == e.Button).ToList(); if (mouseDownDUIControls.Count == 0) { return; } e = new DUIMouseEventArgs(e.Button, e.Clicks, PointToCanvas(e.Location), e.Delta); if (mouseDownDUIControls[0].AffectedControl == this) { this.AlwaysMouseUp(this, e); this.InvokeOnMouseUp(this, e); } else { this.DUIControls.OfType <DUIControl>().Where(d => d.Visible).ToList().ForEach(d => { d.DoMouseUp(new DUIMouseEventArgs(e.Button, e.Clicks, d.PointFromParent(e.Location), e.Delta)); }); } }
public override void OnMouseMove(DUIMouseEventArgs e) { base.OnMouseMove(e); displayCubeEditor.BindingDisplayCube(displayCubes.FirstOrDefault(d => d.Bounds.Contains(e.Location))); }
public override void OnMouseUp(DUIMouseEventArgs e) { base.OnMouseUp(e); this.editableControl.SetCenterChanged(this.ThisCenter); }
public override void PerformMouseWheel(DUIMouseEventArgs e) { base.PerformMouseWheel(new DUIMouseEventArgs(e.Button, e.Clicks, PointToCanvas(e.Location), e.Delta)); }
public override void OnMouseClick(DUIMouseEventArgs e) { base.OnMouseClick(e); OnClick(EventArgs.Empty); }
public override void OnMouseDown(DUIMouseEventArgs e) { base.OnMouseDown(e); this.isMouseDown = true; this.Invalidate(); }
public override void OnMouseUp(DUIMouseEventArgs e) { base.OnMouseUp(e); this.bingingDisplayCube?.SetLocation(this.ClientBounds.Location); this.BindingDisplayCube(null); }
public override void OnMouseDown(DUIMouseEventArgs e) { base.OnMouseDown(e); this.isArrowMouseDragCanvasMouseDown = true; }
public override void OnMouseUp(DUIMouseEventArgs e) { this.editableControl.SetCenterChanged(this.ThisCenter); this.isMouseDownInRotateBounds = false; this.mouseMovePoint = new PointF(this.Width - this.ThisRadius, this.Height / 2); }
public override void OnMouseUp(DUIMouseEventArgs e) { base.OnMouseUp(e); this.Cursor = Cursors.Default; this.isArrowMouseDragCanvasMouseDown = false; }
private void Control_MouseUp(object sender, DUIMouseEventArgs e) { this.isControlMouseDown = false; this.Invalidate(); }
internal override void DoMouseMove(DUIMouseEventArgs e) { base.DoMouseMove(new DUIMouseEventArgs(e.Button, e.Clicks, PointToCanvas(e.Location), e.Delta)); }
internal override void DoMouseDown(DUIMouseEventArgs e) { lastMousePoint = e.Location; base.DoMouseDown(new DUIMouseEventArgs(e.Button, e.Clicks, PointToCanvas(e.Location), e.Delta)); }