public override void FormatToDrawItem(HCCustomData aRichData, int aItemNo) { HCStyle vStyle = aRichData.Style; vStyle.ApplyTempStyle(TextStyleNo); int vH = vStyle.TempCanvas.TextHeight("H"); int vLeftW = Math.Max(vStyle.TempCanvas.TextWidth(FLeftText), Padding); int vTopW = Math.Max(vStyle.TempCanvas.TextWidth(TopText), Padding); int vRightW = Math.Max(vStyle.TempCanvas.TextWidth(FRightText), Padding); int vBottomW = Math.Max(vStyle.TempCanvas.TextWidth(BottomText), Padding); // 计算尺寸 if (vTopW > vBottomW) { Width = vLeftW + vTopW + vRightW + 6 * Padding; } else { Width = vLeftW + vBottomW + vRightW + 6 * Padding; } Height = vH * 2 + 4 * Padding; // 计算各字符串位置 FLeftRect = HC.Bounds(Padding, (Height - vH) / 2, vLeftW, vH); FRightRect = HC.Bounds(Width - Padding - vRightW, (Height - vH) / 2, vRightW, vH); TopRect = HC.Bounds(FLeftRect.Right + Padding + (FRightRect.Left - Padding - (FLeftRect.Right + Padding) - vTopW) / 2, Padding, vTopW, vH); BottomRect = HC.Bounds(FLeftRect.Right + Padding + (FRightRect.Left - Padding - (FLeftRect.Right + Padding) - vBottomW) / 2, Height - Padding - vH, vBottomW, vH); }
// private bool ImageMouseDown(MouseEventArgs e) { if (PtInImageToolBar(e.X, e.Y)) { MouseEventArgs vEvent = new MouseEventArgs(e.Button, e.Clicks, e.X - FImageToolBar.Left, e.Y - FImageToolBar.Top, e.Delta); FImageToolBar.MouseDown(vEvent); if (FImageToolBar.ActiveIndex >= 0) { (FActiveItem as HCImageItem).ShapeManager.OperStyle = (HCShapeStyle)FImageToolBar.ActiveControl().Tag; } return(true); } else { 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.MouseDown(vEvent)) { this.UpdateView(new RECT(FActiveItemRect.Left, FActiveItemRect.Top - FImageToolBar.Height, FActiveItemRect.Right, FActiveItemRect.Bottom)); return(true); } } } return(false); }
private bool ImageMouseUp(MouseEventArgs e) { if (PtInImageToolBar(e.X, e.Y)) { MouseEventArgs vEvent = new MouseEventArgs(e.Button, e.Clicks, e.X - FImageToolBar.Left, e.Y - FImageToolBar.Top, e.Delta); FImageToolBar.MouseUp(vEvent); return(true); } 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.MouseUp(vEvent)) { return(true); } } else { DoImageShapeStructOver(null, e); } } return(false); }
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 { if (HC.PtInRect(HC.Bounds(FItems[i].Rect.Left, FItems[i].Rect.Top, RadioButtonWidth, RadioButtonWidth), x, y)) { Result = i; break; } } } return(Result); }
protected override void DoPaint(HCStyle aStyle, RECT aDrawRect, int aDataDrawTop, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo) { base.DoPaint(aStyle, aDrawRect, aDataDrawTop, aDataDrawBottom, aDataScreenTop, aDataScreenBottom, aCanvas, aPaintInfo); if (FMouseIn) { aCanvas.Brush.Color = HC.clBtnFace; aCanvas.FillRect(aDrawRect); } aStyle.TextStyles[TextStyleNo].ApplyStyle(aCanvas, aPaintInfo.ScaleY / aPaintInfo.Zoom); POINT vPoint = new POINT(); RECT vItemRect = new RECT(); for (int i = 0; i <= FItems.Count - 1; i++) { vPoint.X = FItems[i].Position.X; vPoint.Y = FItems[i].Position.Y; vPoint.Offset(aDrawRect.Left, aDrawRect.Top); vItemRect = HC.Bounds(vPoint.X, vPoint.Y, RadioButtonWidth, RadioButtonWidth); if (FItems[i].Checked) { User.DrawFrameControl(aCanvas.Handle, ref vItemRect, Kernel.DFC_BUTTON, Kernel.DFCS_CHECKED | Kernel.DFCS_BUTTONRADIO); } else { User.DrawFrameControl(aCanvas.Handle, ref vItemRect, Kernel.DFC_BUTTON, Kernel.DFCS_BUTTONRADIO); } aCanvas.TextOut(vPoint.X + RadioButtonWidth, vPoint.Y, FItems[i].Text); } }
public override void FormatToDrawItem(HCCustomData aRichData, int aItemNo) { HCStyle vStyle = aRichData.Style; ApplySupSubStyle(vStyle.TextStyles[TextStyleNo], vStyle.TempCanvas); int vH = vStyle.TempCanvas.TextHeight("H"); int vTopW = Math.Max(vStyle.TempCanvas.TextWidth(FSupText), FPadding); int vBottomW = Math.Max(vStyle.TempCanvas.TextWidth(FSubText), FPadding); // 计算尺寸 if (vTopW > vBottomW) { Width = vTopW + 4 * FPadding; } else { Width = vBottomW + 4 * FPadding; } Height = vH * 2 + 4 * FPadding; // 计算各字符串位置 FSupRect = HC.Bounds(FPadding, FPadding, vTopW, vH); FSubRect = HC.Bounds(FPadding, Height - FPadding - vH, vBottomW, vH); }
private int FResizeWidth, FResizeHeight; // 缩放后的宽、高 private GripType GetGripType(int x, int y) { POINT vPt = new POINT(x, y); if (HC.PtInRect(HC.Bounds(0, 0, GripSize, GripSize), vPt)) { return(GripType.gtLeftTop); } else if (HC.PtInRect(HC.Bounds(Width - GripSize, 0, GripSize, GripSize), vPt)) { return(GripType.gtRightTop); } else if (HC.PtInRect(HC.Bounds(0, Height - GripSize, GripSize, GripSize), vPt)) { return(GripType.gtLeftBottom); } else if (HC.PtInRect(HC.Bounds(Width - GripSize, Height - GripSize, GripSize, GripSize), vPt)) { return(GripType.gtRightBottom); } else { return(GripType.gtNone); } }
public override void FormatToDrawItem(HCCustomData aRichData, int aItemNo) { HCStyle vStyle = aRichData.Style; vStyle.ApplyTempStyle(TextStyleNo); int vH = vStyle.TextStyles[TextStyleNo].FontHeight; int vTopW = Math.Max(vStyle.TempCanvas.TextWidth(FTopText), FPadding); int vBottomW = Math.Max(vStyle.TempCanvas.TextWidth(FBottomText), FPadding); // 计算尺寸 if (vTopW > vBottomW) { Width = vTopW + 4 * FPadding; } else { Width = vBottomW + 4 * FPadding; } Height = vH * 2 + 4 * FPadding; // 计算各字符串位置 FTopRect = HC.Bounds(FPadding + (Width - FPadding - FPadding - vTopW) / 2, FPadding, vTopW, vH); FBottomRect = HC.Bounds(FPadding + (Width - FPadding - FPadding - vBottomW) / 2, Height - FPadding - vH, vBottomW, vH); }
private bool TableMouseMove(MouseEventArgs e) { if (PtInTableToolBar(e.X, e.Y)) { if (FHotToolBar != FTableToolBar) { if (FHotToolBar != null) { FHotToolBar.MouseLeave(); } FHotToolBar = FTableToolBar; FHotToolBar.MouseEnter(); } } else if (FHotToolBar == FTableToolBar) { FTableToolBar.MouseLeave(); FHotToolBar = null; } 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 void FormatToDrawItem(HCCustomData ARichData, int AItemNo) { if (this.AutoSize) { ARichData.Style.ApplyTempStyle(TextStyleNo); SIZE vSize = new SIZE(); if (this.Text != "") { vSize = ARichData.Style.TempCanvas.TextExtent(this.Text); } else { vSize = ARichData.Style.TempCanvas.TextExtent("H"); } Width = FMargin + vSize.cx + FMargin + BTNWIDTH; // 间距 Height = FMargin + vSize.cy + FMargin; } if (Width < FMinWidth) { Width = FMinWidth; } if (Height < FMinHeight) { Height = FMinHeight; } FButtonRect = HC.Bounds(Width - BTNMARGIN - BTNWIDTH, BTNMARGIN, BTNWIDTH, Height - BTNMARGIN - BTNMARGIN); FPopupForm.Width = this.Width; }
public void UpdateView(RECT aRect) { if (!FVisible) { return; } FGraphicCanvas.Brush.Color = HC.clBtnFace; FGraphicCanvas.FillRect(HC.Bounds(0, 0, FGraphic.Width, FGraphic.Height)); FGraphicCanvas.Pen.Color = Color.FromArgb(240, 240, 240); FGraphicCanvas.MoveTo(0, 0); FGraphicCanvas.LineTo(0, FGraphic.Height - 2); FGraphicCanvas.LineTo(FGraphic.Width - 2, FGraphic.Height - 2); FGraphicCanvas.LineTo(FGraphic.Width - 2, 0); FGraphicCanvas.LineTo(0, 0); FGraphicCanvas.Pen.Color = Color.FromArgb(0x66, 0x66, 0x66); FGraphicCanvas.MoveTo(1, FGraphic.Height - 1); FGraphicCanvas.LineTo(FGraphic.Width - 1, FGraphic.Height - 1); FGraphicCanvas.LineTo(FGraphic.Width - 1, 1); int vLeft = FPadding; for (int i = 0; i < FControls.Count; i++) { if (FControls[i] is HCCustomToolButton) { if (i == FActiveIndex) { FGraphicCanvas.Brush.Color = Color.FromArgb(51, 153, 255); FGraphicCanvas.FillRect(HC.Bounds(vLeft, 1, FControls[i].Width, FGraphic.Height - 3)); } else if (i == FHotIndex) { FGraphicCanvas.Brush.Color = Color.FromArgb(0, 102, 204); FGraphicCanvas.FillRect(HC.Bounds(vLeft, 1, FControls[i].Width, FGraphic.Height - 3)); } if (FOnControlPaint != null) { FOnControlPaint(FControls[i], vLeft, 0, FGraphicCanvas); } else { FControls[i].PaintTo(vLeft, 0, FGraphicCanvas); } } vLeft = vLeft + FControls[i].Width + FPadding; } if (FOnUpdateView != null) { FOnUpdateView(aRect, FGraphicCanvas); } }
private RECT GetBoxRect() { if (FBoxRight) { return(HC.Bounds(Width - FPaddingLeft - CheckBoxSize, (Height - CheckBoxSize) / 2, CheckBoxSize, CheckBoxSize)); } else { return(HC.Bounds(FPaddingLeft, (Height - CheckBoxSize) / 2, CheckBoxSize, CheckBoxSize)); } }
/// <summary> /// 得到鼠标上去要实现改变的区域 /// </summary> private void ReCalcButtonRect() { if (FOrientation == View.Orientation.oriHorizontal) { FLeftBtnRect = HC.Bounds(FLeftBlank, 0, ButtonSize, Height); FRightBtnRect = HC.Bounds(Width - FRightBlank - ButtonSize, 0, ButtonSize, Height); } else { FLeftBtnRect = HC.Bounds(0, FLeftBlank, Width, ButtonSize); FRightBtnRect = HC.Bounds(0, Height - FRightBlank - ButtonSize, Width, ButtonSize); } }
public virtual void PaintFloatItems(int APageIndex, int ADataDrawLeft, int ADataDrawTop, int AVOffset, HCCanvas ACanvas, PaintInfo APaintInfo) { HCFloatItem vFloatItem = null; for (int i = 0; i <= FFloatItems.Count - 1; i++) { vFloatItem = FFloatItems[i]; vFloatItem.DrawRect = HC.Bounds(vFloatItem.Left, vFloatItem.Top, vFloatItem.Width, vFloatItem.Height); vFloatItem.DrawRect.Offset(ADataDrawLeft, ADataDrawTop - AVOffset); // 将数据起始位置映射到绘制位置 vFloatItem.PaintTo(this.Style, vFloatItem.DrawRect, ADataDrawTop, 0, 0, 0, ACanvas, APaintInfo); } }
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 FResizeX, FResizeY; // 拖动缩放时起始位置 protected override void DoPaint(HCStyle aStyle, RECT aDrawRect, int aDataDrawTop, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo) { base.DoPaint(aStyle, aDrawRect, aDataDrawTop, aDataDrawBottom, aDataScreenTop, aDataScreenBottom, aCanvas, aPaintInfo); if ((!aPaintInfo.Print) && Active) { if (Resizing) { switch (FResizeGrip) { case GripType.gtLeftTop: FResizeRect = HC.Bounds(aDrawRect.Left + Width - FResizeWidth, aDrawRect.Top + Height - FResizeHeight, FResizeWidth, FResizeHeight); break; case GripType.gtRightTop: FResizeRect = HC.Bounds(aDrawRect.Left, aDrawRect.Top + Height - FResizeHeight, FResizeWidth, FResizeHeight); break; case GripType.gtLeftBottom: FResizeRect = HC.Bounds(aDrawRect.Left + Width - FResizeWidth, aDrawRect.Top, FResizeWidth, FResizeHeight); break; case GripType.gtRightBottom: FResizeRect = HC.Bounds(aDrawRect.Left, aDrawRect.Top, FResizeWidth, FResizeHeight); break; } aPaintInfo.TopItems.Add(this); } if (AllowResize) // 绘制缩放拖动提示锚点 { aCanvas.Brush.Color = Color.Gray; aCanvas.FillRect(HC.Bounds(aDrawRect.Left, aDrawRect.Top, GripSize, GripSize)); aCanvas.FillRect(HC.Bounds(aDrawRect.Right - GripSize, aDrawRect.Top, GripSize, GripSize)); aCanvas.FillRect(HC.Bounds(aDrawRect.Left, aDrawRect.Bottom - GripSize, GripSize, GripSize)); aCanvas.FillRect(HC.Bounds(aDrawRect.Right - GripSize, aDrawRect.Bottom - GripSize, GripSize, GripSize)); } } }
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); }
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); }
protected override void DoDrawThumBefor(HCCanvas ACanvas, RECT AThumRect) { if (this.Orientation == View.Orientation.oriVertical) { if (FAreaMarks != null) { ACanvas.Brush.Color = Color.Blue; int vDrawTop = 0, vDrawHeight = 0; for (int i = 0; i <= FAreaMarks.Count - 1; i++) { vDrawTop = ButtonSize + (int)Math.Round(FAreaMarks[i].Position * Percent); vDrawHeight = (int)Math.Round(FAreaMarks[i].Height * Percent); ACanvas.FillRect(HC.Bounds(AThumRect.Left, vDrawTop, AThumRect.Width, vDrawHeight)); } } } }
public override void PaintFloatItems(int aPageIndex, int aDataDrawLeft, int aDataDrawTop, int aVOffset, HCCanvas aCanvas, PaintInfo aPaintInfo) { HCCustomFloatItem vFloatItem = null; for (int i = 0; i <= this.FloatItems.Count - 1; i++) { vFloatItem = this.FloatItems[i]; if (vFloatItem.PageIndex == aPageIndex) { vFloatItem.DrawRect = HC.Bounds(vFloatItem.Left, vFloatItem.Top, vFloatItem.Width, vFloatItem.Height); vFloatItem.DrawRect.Offset(aDataDrawLeft, aDataDrawTop - aVOffset); // 将数据起始位置映射到绘制位置 vFloatItem.PaintTo(this.Style, vFloatItem.DrawRect, aDataDrawTop, 0, 0, 0, aCanvas, aPaintInfo); } } }
private RECT GetAreaMarkRect(int aIndex) { RECT Result = new RECT(); if (this.Orientation == Orientation.oriVertical) { int vTop = FLeftBlank + HCScrollBar.ButtonSize + (int)Math.Round(FAreaMarks[aIndex].Position * Percent); int vHeight = (int)Math.Round(FAreaMarks[aIndex].Height * Percent); if (vHeight < 2) { vHeight = 2; } Result = HC.Bounds(0, vTop, Width, vHeight); } return(Result); }
protected int FResizeX, FResizeY; // 拖动缩放时起始位置 protected override void DoPaint(HCStyle AStyle, RECT ADrawRect, int ADataDrawTop, int ADataDrawBottom, int ADataScreenTop, int ADataScreenBottom, HCCanvas ACanvas, PaintInfo APaintInfo) { base.DoPaint(AStyle, ADrawRect, ADataDrawTop, ADataDrawBottom, ADataScreenTop, ADataScreenBottom, ACanvas, APaintInfo); if ((!APaintInfo.Print) && Active) { if (Resizing) { switch (FResizeGrip) { case GripType.gtLeftTop: FResizeRect = HC.Bounds(ADrawRect.Left + Width - FResizeWidth, ADrawRect.Top + Height - FResizeHeight, FResizeWidth, FResizeHeight); break; case GripType.gtRightTop: FResizeRect = HC.Bounds(ADrawRect.Left, ADrawRect.Top + Height - FResizeHeight, FResizeWidth, FResizeHeight); break; case GripType.gtLeftBottom: FResizeRect = HC.Bounds(ADrawRect.Left + Width - FResizeWidth, ADrawRect.Top, FResizeWidth, FResizeHeight); break; case GripType.gtRightBottom: FResizeRect = HC.Bounds(ADrawRect.Left, ADrawRect.Top, FResizeWidth, FResizeHeight); break; } APaintInfo.TopItems.Add(this); } // 绘制缩放拖动提示锚点 ACanvas.Brush.Color = Color.Gray; ACanvas.FillRect(HC.Bounds(ADrawRect.Left, ADrawRect.Top, GripSize, GripSize)); ACanvas.FillRect(HC.Bounds(ADrawRect.Right - GripSize, ADrawRect.Top, GripSize, GripSize)); ACanvas.FillRect(HC.Bounds(ADrawRect.Left, ADrawRect.Bottom - GripSize, GripSize, GripSize)); ACanvas.FillRect(HC.Bounds(ADrawRect.Right - GripSize, ADrawRect.Bottom - GripSize, GripSize, GripSize)); } }
private void DoPopupFormPaint(HCCanvas ACanvas, RECT AClientRect) { ACanvas.Brush.Color = HC.clInfoBk; ACanvas.FillRect(GetItemRect()); // AClientRect ACanvas.Font.Size = DROPDOWNFONTSIZE; // 10号字,高14 int vStartIndex = 0, vEndIndex = 0; GetDisplayRange(AClientRect, ref vStartIndex, ref vEndIndex); int vTop = 0; if (ScrollBarVisible()) { vTop = vStartIndex * DROPDOWNITEMHEIGHT - FScrollBar.Position; } for (int i = vStartIndex; i <= vEndIndex; i++) { if (i == FMoveItemIndex) { ACanvas.Brush.Color = HC.clHighlight; ACanvas.FillRect(HC.Bounds(0, vTop, Width, DROPDOWNITEMHEIGHT)); } else { ACanvas.Brush.Color = HC.clInfoBk; } ACanvas.TextOut(2, vTop + 2, FItems[i]); vTop = vTop + DROPDOWNITEMHEIGHT; } if (ScrollBarVisible()) { POINT vPt = new POINT(); GDI.GetWindowOrgEx(ACanvas.Handle, ref vPt); GDI.SetWindowOrgEx(ACanvas.Handle, vPt.X - (Width - FScrollBar.Width), vPt.Y, ref vPt /*null*/); //User.MoveWindowOrg(ACanvas.Handle, Width - FScrollBar.Width, 0); GDI.IntersectClipRect(ACanvas.Handle, 0, 0, FScrollBar.Width, FScrollBar.Height); // 创建新的剪切区域,该区域是当前剪切区域和一个特定矩形的交集 FScrollBar.PaintToEx(ACanvas); } }
public virtual void PaintFloatItems(int aPageIndex, int aDataDrawLeft, int aDataDrawTop, int aVOffset, HCCanvas aCanvas, PaintInfo aPaintInfo) { HCCustomFloatItem vFloatItem = null; for (int i = 0; i <= FFloatItems.Count - 1; i++) { vFloatItem = FFloatItems[i]; // 代替下面不生效的代码 RECT vRect = HC.Bounds(vFloatItem.Left, vFloatItem.Top, vFloatItem.Width, vFloatItem.Height); vRect.Offset(aDataDrawLeft, aDataDrawTop - aVOffset); // 将数据起始位置映射到绘制位置 vFloatItem.DrawRect = vRect; // 下面的操作vFloatItemDraw.DrawRect.Offset并不生效 //vFloatItem.DrawRect = HC.Bounds(vFloatItem.Left, vFloatItem.Top, vFloatItem.Width, vFloatItem.Height); //vFloatItem.DrawRect.Offset(aDataDrawLeft, aDataDrawTop - aVOffset); // 将数据起始位置映射到绘制位置 vFloatItem.PaintTo(this.Style, vFloatItem.DrawRect, aDataDrawTop, 0, 0, 0, aCanvas, aPaintInfo); } }
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 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); }
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 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 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); } } } }
public virtual RECT ClientRect() { return(HC.Bounds(0, 0, 0, 0)); }