From 87313eadfb2d01b53243551ae2c935226140dc94 Mon Sep 17 00:00:00 2001 From: tdx Date: Sun, 28 Sep 2025 08:24:08 +0000 Subject: [PATCH] SVN r1005 SVN-Revision: r1005 --- 插件库/Lskj.Control/GridControlEx.cs | 39 +++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/插件库/Lskj.Control/GridControlEx.cs b/插件库/Lskj.Control/GridControlEx.cs index d001b98..914ee9f 100644 --- a/插件库/Lskj.Control/GridControlEx.cs +++ b/插件库/Lskj.Control/GridControlEx.cs @@ -9772,4 +9772,41 @@ namespace Lskj.Control return Rectangle.Empty; // 转换为网格控件内的坐标(关键修正) - \ No newline at end of file + Point cellLocation = view.GridControl.PointToClient( + viewInfo.GridControl.PointToScreen(cellInfo.Bounds.Location) + ); + + return new Rectangle( + cellLocation.X, + cellLocation.Y, + cellInfo.Bounds.Width, + cellInfo.Bounds.Height + ); + } + catch + { + return Rectangle.Empty; + } + } + + // 计算按钮起始X坐标(支持左右对齐) + private int GetButtonStartX(int cellWidth, int totalButtonsWidth, bool isLeftAligned) + { + if (isLeftAligned) + { + // 靠左对齐:从单元格左侧开始 + return 0; + } + else + { + // 靠右对齐:从右侧减去总宽度 + return cellWidth - totalButtonsWidth; + } + } + + + #endregion + + + } +} \ No newline at end of file