private bool PtInRightBlankArea(int x, int y) { if (FRightBlank != 0) { if (FOrientation == Orientation.oriHorizontal) { return(HC.PtInRect(HC.Bounds(Width - FRightBlank, 0, FRightBlank, Height), new POINT(x, y))); } else { return(HC.PtInRect(HC.Bounds(0, Height - FRightBlank, Width, FRightBlank), new POINT(x, y))); } } return(false); }
protected int GetPointAt(int x, int y) { HCPoint vPoint = null; for (int i = 0; i < FPoints.Count; i++) { vPoint = FPoints[i]; if (HC.PtInRect(new RECT(vPoint.X - PointSize, vPoint.Y - PointSize, vPoint.X + PointSize, vPoint.Y + PointSize), new POINT(x, y))) { return(i); } } return(-1); }
private void DoPopupFormMouseUp(object sender, MouseEventArgs e) { RECT vRect = GetItemRect(); if (HC.PtInRect(vRect, e.X, e.Y)) { this.ItemIndex = GetItemIndexAt(e.X, e.Y); FPopupForm.ClosePopup(false); } else if (ScrollBarVisible()) { MouseEventArgs vEventArgs = new MouseEventArgs(e.Button, e.Clicks, e.X - vRect.Right, e.Y - vRect.Top, e.Delta); FScrollBar.DoMouseUp(vEventArgs); } }
protected override HCShapeLineObj GetObjAt(int x, int y) { HCShapeLineObj vResult = HCShapeLineObj.sloNone; if (HC.PtInRect(new RECT(StartPt.X - PointSize, StartPt.Y - PointSize, StartPt.X + PointSize, StartPt.Y + PointSize), new POINT(x, y))) { vResult = HCShapeLineObj.sloStart; } else if (HC.PtInRect(new RECT(EndPt.X - PointSize, EndPt.Y - PointSize, EndPt.X + PointSize, EndPt.Y + PointSize), new POINT(x, y))) { vResult = HCShapeLineObj.sloEnd; } else { RECT vRect = ClientRect(); vRect.Inflate(PointSize, PointSize); IntPtr vRgn1 = GDI.CreateEllipticRgnIndirect(ref vRect); try { if (GDI.PtInRegion(vRgn1, x, y)) // 在外围 { vRect.Inflate(-PointSize - PointSize, -PointSize - PointSize); IntPtr vRgn2 = GDI.CreateEllipticRgnIndirect(ref vRect); try { if (!GDI.PtInRegion(vRgn2, x, y)) // 不在内围 { vResult = HCShapeLineObj.sloLine; } } finally { GDI.DeleteObject(vRgn2); } } } finally { GDI.DeleteObject(vRgn1); } } return(vResult); }
protected virtual ExpressArea GetExpressArea(int x, int y) { ExpressArea Result = ExpressArea.ceaNone; POINT vPt = new POINT(x, y); if (HC.PtInRect(FSupRect, vPt)) { Result = ExpressArea.ceaTop; } else if (HC.PtInRect(FSubRect, vPt)) { Result = ExpressArea.ceaBottom; } return(Result); }
private bool ImageMouseMove(MouseEventArgs e) { if (PtInImageToolBar(e.X, e.Y)) { if (FHotToolBar != FImageToolBar) { if (FHotToolBar != null) { FHotToolBar.MouseLeave(); } FHotToolBar = FImageToolBar; FHotToolBar.MouseEnter(); this.Cursor = Cursors.Default; } } else if (FHotToolBar == FImageToolBar) { FImageToolBar.MouseLeave(); FHotToolBar = null; } else //if FImageToolBar.ActiveIndex > 0 then // 有效的样式、第一个是指针 { HCImageItem vImageItem = FActiveItem as HCImageItem; if (HC.PtInRect(HC.Bounds(FActiveItemRect.Left, FActiveItemRect.Top, vImageItem.Width, vImageItem.Height), new POINT(FMouseViewPt.X, FMouseViewPt.Y))) { MouseEventArgs vEvent = new MouseEventArgs(e.Button, e.Clicks, FMouseViewPt.X - FActiveItemRect.Left, FMouseViewPt.Y - FActiveItemRect.Top, e.Delta); if (vImageItem.ShapeManager.MouseMove(vEvent)) { this.UpdateView(new RECT(FActiveItemRect.Left, FActiveItemRect.Top - FImageToolBar.Height, FActiveItemRect.Right, FActiveItemRect.Bottom)); if (vImageItem.ShapeManager.HotIndex >= 0) { Cursor = vImageItem.ShapeManager[vImageItem.ShapeManager.HotIndex].Cursor; } return(true); } } } return(false); }
private int GetControlAt(int x, int y) { POINT vPt = new POINT(x, y); int vLeft = FPadding; for (int i = 0; i < FControls.Count; i++) { if (HC.PtInRect(HC.Bounds(vLeft, 0, FControls[i].Width, FControls[i].Height), vPt)) { return(i); } vLeft += FControls[i].Width + FPadding; } return(-1); }
protected override ExpressArea GetExpressArea(int x, int y) { ExpressArea Result = base.GetExpressArea(x, y); if (Result == ExpressArea.ceaNone) { POINT vPt = new POINT(x, y); if (HC.PtInRect(FLeftRect, vPt)) return ExpressArea.ceaLeft; else if (HC.PtInRect(FRightRect, vPt)) return ExpressArea.ceaRight; else return Result; } else return Result; }
protected virtual ExpressArea GetExpressArea(int x, int y) { POINT vPt = new POINT(x, y); if (HC.PtInRect(FTopRect, vPt)) { return(ExpressArea.ceaTop); } else if (HC.PtInRect(FBottomRect, vPt)) { return(ExpressArea.ceaBottom); } else { return(ExpressArea.ceaNone); } }
public void DoMouseDown(MouseEventArgs e) { base.OnMouseDown(e); FMouseDownPt.X = e.X; FMouseDownPt.Y = e.Y; if (HC.PtInRect(FLeftBtnRect, FMouseDownPt)) { FMouseDownControl = BarControl.cbcLeftBtn; // 鼠标所在区域类型 ScrollStep(ScrollCode.scLineUp); // 数据向上(左)滚动 } else if (HC.PtInRect(FThumRect, FMouseDownPt)) { FMouseDownControl = BarControl.cbcThum; } else if (HC.PtInRect(FRightBtnRect, FMouseDownPt)) { FMouseDownControl = BarControl.cbcRightBtn; ScrollStep(ScrollCode.scLineDown); // 数据向下(右)滚动 } else // 鼠标在滚动条的其他区域 if (PtInLeftBlankArea(e.X, e.Y)) // 左空白区域 { } else if (PtInRightBlankArea(e.X, e.Y)) // 右空白区域 { } else { FMouseDownControl = BarControl.cbcBar; // 滚动条其他区域类型 if ((FThumRect.Top > e.Y) || (FThumRect.Left > e.X)) { ScrollStep(ScrollCode.scPageUp); // 数据向上(左)翻页 } else if ((FThumRect.Bottom < e.Y) || (FThumRect.Right < e.X)) { ScrollStep(ScrollCode.scPageDown); // 数据向下(右)翻页 } } }
private DateTimeArea GetAreaAt(int x, int y) { POINT vPt = new POINT(x, y); if (HC.PtInRect(GetAreaRect(DateTimeArea.dtaYear), vPt)) { return(DateTimeArea.dtaYear); } else if (HC.PtInRect(GetAreaRect(DateTimeArea.dtaMonth), vPt)) { return(DateTimeArea.dtaMonth); } else if (HC.PtInRect(GetAreaRect(DateTimeArea.dtaDay), vPt)) { return(DateTimeArea.dtaDay); } else if (HC.PtInRect(GetAreaRect(DateTimeArea.dtaHour), vPt)) { return(DateTimeArea.dtaHour); } else if (HC.PtInRect(GetAreaRect(DateTimeArea.dtaMinute), vPt)) { return(DateTimeArea.dtaMinute); } else if (HC.PtInRect(GetAreaRect(DateTimeArea.dtaSecond), vPt)) { return(DateTimeArea.dtaSecond); } else if (HC.PtInRect(GetAreaRect(DateTimeArea.dtaMillisecond), vPt)) { return(DateTimeArea.dtaMillisecond); } else { return(DateTimeArea.dtaNone); } }
private int GetItemAt(int X, int Y) { int Result = -1; this.OwnerData.Style.TextStyles[TextStyleNo].ApplyStyle(this.OwnerData.Style.DefCanvas); SIZE vSize = new SIZE(); for (int i = 0; i <= FItems.Count - 1; i++) { vSize = this.OwnerData.Style.DefCanvas.TextExtent(FItems[i].Text); if (HC.PtInRect(HC.Bounds(FItems[i].Position.X, FItems[i].Position.Y, RadioButtonWidth + vSize.cx, vSize.cy), X, Y)) { Result = i; break; } } return Result; }
private void DoPopupFormMouseMove(object sender, MouseEventArgs e) { RECT vRect = GetItemRect(); if (HC.PtInRect(vRect, e.X, e.Y)) { int vIndex = GetItemIndexAt(e.X, e.Y); if (vIndex != FMoveItemIndex) { FMoveItemIndex = vIndex; FPopupForm.UpdatePopup(); } } else if (ScrollBarVisible()) { MouseEventArgs vEventArgs = new MouseEventArgs(e.Button, e.Clicks, e.X - vRect.Right, e.Y - vRect.Top, e.Delta); FScrollBar.DoMouseMove(vEventArgs); } }
private bool TableMouseUp(MouseEventArgs e) { if (PtInTableToolBar(e.X, e.Y)) { MouseEventArgs vEvent = new MouseEventArgs(e.Button, e.Clicks, e.X - FTableToolBar.Left, e.Y - FTableToolBar.Top, e.Delta); FTableToolBar.MouseUp(vEvent); return(true); } else //if FTableToolBar.ActiveIndex > 0 then // 第一个是指针 { HCTableItem vTableItem = FActiveItem as HCTableItem; if (HC.PtInRect(HC.Bounds(FActiveItemRect.Left, FActiveItemRect.Top, vTableItem.Width, vTableItem.Height), new POINT(FMouseViewPt.X, FMouseViewPt.Y))) { return(true); } } return(false); }
public override bool MouseUp(MouseEventArgs e) { if (OwnerData.CanEdit() && !OwnerData.Style.UpdateInfo.Selecting) { if (FItemHit) { OwnerData.Style.ApplyTempStyle(TextStyleNo); SIZE vSize = OwnerData.Style.TempCanvas.TextExtent(FText); if (HC.PtInRect(HC.Bounds(FPaddingLeft, 0, FPaddingLeft + CheckBoxSize + FPaddingLeft + vSize.cx, vSize.cy), e.X, e.Y)) { DoSetChecked(!FChecked); } } else if (HC.PtInRect(GetBoxRect(), e.X, e.Y)) // 点在了勾选框中 { DoSetChecked(!FChecked); } } return(base.MouseUp(e)); }
protected virtual HCShapeLineObj GetObjAt(int x, int y) { HCShapeLineObj vResult = HCShapeLineObj.sloNone; if (HC.PtInRect(new RECT(FStartPt.X - PointSize, FStartPt.Y - PointSize, FStartPt.X + PointSize, FStartPt.Y + PointSize), new POINT(x, y))) { vResult = HCShapeLineObj.sloStart; } else if (HC.PtInRect(new RECT(FEndPt.X - PointSize, FEndPt.Y - PointSize, FEndPt.X + PointSize, FEndPt.Y + PointSize), new POINT(x, y))) { vResult = HCShapeLineObj.sloEnd; } else { POINT[] vPointArr = new POINT[4]; vPointArr[0] = new POINT(FStartPt.X - PointSize, FStartPt.Y); vPointArr[1] = new POINT(FStartPt.X + PointSize, FStartPt.Y); vPointArr[2] = new POINT(FEndPt.X + PointSize, FEndPt.Y); vPointArr[3] = new POINT(FEndPt.X - PointSize, FEndPt.Y); IntPtr vRgn = GDI.CreatePolygonRgn(vPointArr, 4, GDI.WINDING); try { if (GDI.PtInRegion(vRgn, x, y)) { vResult = HCShapeLineObj.sloLine; } } finally { GDI.DeleteObject(vRgn); } } return(vResult); }
private int GetItemAt(int x, int y) { int Result = -1; this.OwnerData.Style.ApplyTempStyle(TextStyleNo); SIZE vSize = new SIZE(); for (int i = 0; i <= FItems.Count - 1; i++) { vSize = this.OwnerData.Style.TempCanvas.TextExtent(FItems[i].Text); if (HC.PtInRect(HC.Bounds(FItems[i].Position.X, FItems[i].Position.Y, RadioButtonWidth + vSize.cx, vSize.cy), x, y)) { Result = i; break; } } return(Result); }
public override void MouseDown(System.Windows.Forms.MouseEventArgs e) { //base.MouseDown(e); this.Active = HC.PtInRect(new RECT(0, 0, Width, Height), new POINT(e.X, e.Y)); DateTimeArea vArea = GetAreaAt(e.X, e.Y); if (vArea != FActiveArea) { if (FActiveArea == DateTimeArea.dtaYear) { SetInputYear(); } FActiveArea = vArea; if (FActiveArea != DateTimeArea.dtaNone) { FAreaRect = GetAreaRect(FActiveArea); } this.OwnerData.Style.UpdateInfoRePaint(); } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (this.Orientation == Orientation.oriVertical) { POINT vPt = new POINT(e.X, e.Y); if (HC.PtInRect(HC.Bounds(2, Height - FRightBlank + 2, 16, 16), vPt)) { if (FOnPageUpClick != null) { FOnPageUpClick(this, null); } } else if (HC.PtInRect(HC.Bounds(2, Height - FRightBlank + 2 + 16 + 2, 16, 16), vPt)) { if (FOnPageDownClick != null) { FOnPageDownClick(this, null); } } } }
private HCLineObj GetLineObjAt(int X, int Y) { HCLineObj Result = HCLineObj.cloNone; if (HC.PtInRect(new RECT(FStartPt.X - PointSize, FStartPt.Y - PointSize, FStartPt.X + PointSize, FStartPt.Y + PointSize), new POINT(X, Y))) { Result = HCLineObj.cloLeftOrTop; } else if (HC.PtInRect(new RECT(FEndPt.X - PointSize, FEndPt.Y - PointSize, FEndPt.X + PointSize, FEndPt.Y + PointSize), new POINT(X, Y))) { Result = HCLineObj.cloRightOrBottom; } else { POINT[] vPointArr = new POINT[4]; vPointArr[0] = new POINT(FStartPt.X - PointSize, FStartPt.Y); vPointArr[1] = new POINT(FStartPt.X + PointSize, FStartPt.Y); vPointArr[2] = new POINT(FEndPt.X + PointSize, FEndPt.Y); vPointArr[3] = new POINT(FEndPt.X - PointSize, FEndPt.Y); IntPtr vRgn = (IntPtr)GDI.CreatePolygonRgn(ref vPointArr[0], 4, GDI.WINDING); try { if (GDI.PtInRegion(vRgn, X, Y) > 0) { Result = HCLineObj.cloLine; } } finally { GDI.DeleteObject(vRgn); } } return(Result); }
private int GetItemAt(int x, int y) { int Result = -1; for (int i = 0; i <= FItems.Count - 1; i++) { if (FItemHit) { if (HC.PtInRect(FItems[i].Rect, x, y)) { Result = i; break; } } else { RECT vBoxRect; if (FBoxRight) { vBoxRect = HC.Bounds(FItems[i].Rect.Right - RadioButtonWidth, FItems[i].Rect.Top, RadioButtonWidth, RadioButtonWidth); } else { vBoxRect = HC.Bounds(FItems[i].Rect.Left, FItems[i].Rect.Top, RadioButtonWidth, RadioButtonWidth); } if (HC.PtInRect(vBoxRect, x, y)) { Result = i; break; } } } return(Result); }
public virtual bool PointInClient(POINT aPoint) { return(HC.PtInRect(HC.Bounds(0, 0, Width, Height), aPoint)); }
// public override bool MouseDown(MouseEventArgs e) { this.Active = HC.PtInRect(new RECT(0, 0, FWidth, FHeight), e.X, e.Y); return(this.Active); }
private bool PointInCellRect(POINT aPt) { return(HC.PtInRect(HC.Bounds(0, 0, Width, FCellHeight), aPt)); }
public virtual bool PointInClient(POINT aPoint) { return(HC.PtInRect(ClientRect(), aPoint)); }
public virtual bool PointInClient(int x, int y) { return(HC.PtInRect(ClientRect(), x, y)); }
/// <summary> 获取坐标X、Y是否在选中区域中 </summary> public override bool CoordInSelect(int x, int y) { return(SelectExists() && HC.PtInRect(HC.Bounds(0, 0, Width, Height), x, y) && (GetGripType(x, y) == GripType.gtNone)); }
private bool PtInImageToolBar(int x, int y) { POINT vPt = new POINT(x, y); return(HC.PtInRect(FImageToolBar.Bound(), vPt)); }
public override bool CoordInSelect(int x, int y) { return(SelectExists() && HC.PtInRect(HC.Bounds(0, 0, Width, Height), x, y)); }
public virtual bool PointInClient(int x, int y) { return(HC.PtInRect(HC.Bounds(0, 0, Width, Height), x, y)); }