回复 3楼yaoxiaoqiang00的帖子
请尝试通过以下方法判断活跃单元格,如果不是则返回 Null:
- public class ControlDrawingObject : CustomDrawingObject
- {
- private Control _rootElement;
- public ControlDrawingObject(Worksheet sheet, int row, int col, Control control) : base(row, col) { _rootElement = control; this.ShowDrawingObjectOnly = true; this.Sheet = sheet; }
- public override FrameworkElement RootElement
- {
- get
- {
- if (this.Sheet.ActiveRowIndex == this.AnchorRow && this.Sheet.ActiveColumnIndex == this.AnchorColumn)
- {
- _rootElement.Margin = new Thickness(1);
- return _rootElement;
- }
- return null;
- }
- }
- private Worksheet Sheet { get; set; }
- }
复制代码 |