Create double click event on geometry

I hope to use Rhinocommon to create a plugin that can create custom grid annotation styles, as shown in the figure. I hope that the created grid can pop up a property dialog box by double clicking, similar to the annotation style included in the system, to modify various attribute information of the grid. Unfortunately, I did not find any relevant cases in the forum, but I tried to ask questions on chatgpt and it did not work. The code is as follows:


using Rhino.DocObjects;
using Rhino.Geometry;

public class CustomGridAnnotation : AnnotationBase
{
    public Point3d StartPoint { get; set; }
    public Point3d EndPoint { get; set; }
    public int LineNumber { get; set; }

    public CustomGridAnnotation()
    {
        StartPoint = Point3d.Origin;
        EndPoint = new Point3d(0, 0, 1);
        LineNumber = 1;
    }
}


public class CustomGridAnnotation : AnnotationBase
{
    // ...

    public override bool DrawAnnotation(Rhino.Display.DrawEventArgs e)
    {
        // 在这里编写绘制标注的逻辑
        var display = e.Display;

        // 绘制两个圆形
        // 绘制中间的虚线
        // 在圆形中心绘制序号

        return base.DrawAnnotation(e);
    }
}

public class CustomGridAnnotation : AnnotationBase
{
    // ...

    // 在构造函数中添加事件处理程序
    public CustomGridAnnotation()
    {
        // 其他初始化逻辑

        // 添加双击事件处理程序
        RhinoDoc.ReplaceRhinoObjectEvent += OnReplaceRhinoObject;
    }

    // 处理双击事件
    private void OnReplaceRhinoObject(object sender, RhinoReplaceObjectEventArgs e)
    {
        if (e.Document != null && e.Document.Objects.Find(e.OldRhinoObject.Id) is CustomGridAnnotation customAnnotation)
        {
            // 检查是否双击的是自定义标注对象
            if (e.Mode == RhinoReplaceObjectMode.Remove && e.NewRhinoObject != null)
            {
                // 在此处弹出属性编辑对话框
                var form = new CustomAnnotationEditForm(customAnnotation);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    // 用户点击了对话框的确认按钮,更新属性
                    customAnnotation = form.CustomAnnotation; // 更新标注对象属性
                    e.Document.Objects.Replace(customAnnotation.Id, customAnnotation);
                    e.Document.Views.Redraw();
                }
            }
        }
    }

    // ...
}

public class CustomAnnotationEditForm : Form
{
    private CustomGridAnnotation _customAnnotation;

    // 构造函数接受自定义标注对象作为参数
    public CustomAnnotationEditForm(CustomGridAnnotation annotation)
    {
        _customAnnotation = annotation;

        // 添加控件以编辑属性,例如起点、终点、序号等

        // 添加确认和取消按钮
        var okButton = new Button();
        okButton.Text = "确认";
        okButton.DialogResult = DialogResult.OK;
        okButton.Click += (sender, e) => { DialogResult = DialogResult.OK; Close(); };

        var cancelButton = new Button();
        cancelButton.Text = "取消";
        cancelButton.DialogResult = DialogResult.Cancel;
        cancelButton.Click += (sender, e) => { DialogResult = DialogResult.Cancel; Close(); };

        // 添加控件到窗体
        // ...
    }

    public CustomGridAnnotation CustomAnnotation
    {
        get { return _customAnnotation; }
    }
}

May I ask if anyone has done any related development? Can you give me some examples or tips