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