C# 在visual studio中应用该工具时,如何在用户控件工具箱中实现接口类,而对象不可用?

C# 在visual studio中应用该工具时,如何在用户控件工具箱中实现接口类,而对象不可用?,c#,.net,interface,user-controls,microstation,C#,.net,Interface,User Controls,Microstation,我正在尝试开发以下用户控件 用户控件生成时没有错误。当我尝试在VisualStudio中加载工具箱时,我收到了VisualStudio错误 无法加载文件或程序集“Bentley.Interop.MicrostationDGN” 这是因为它试图在加载工具箱期间加载Bentley.Interop。在这个工具箱中的其他用户控件中,我可以检查Bentley.Interop并忽略这个错误。但是,代码中显示的IlocateCommandEvents接口是ClsPointSelector类构造的一部分。是否有

我正在尝试开发以下用户控件

用户控件生成时没有错误。当我尝试在VisualStudio中加载工具箱时,我收到了VisualStudio错误

无法加载文件或程序集“Bentley.Interop.MicrostationDGN”

这是因为它试图在加载工具箱期间加载Bentley.Interop。在这个工具箱中的其他用户控件中,我可以检查Bentley.Interop并忽略这个错误。但是,代码中显示的IlocateCommandEvents接口是ClsPointSelector类构造的一部分。是否有一种方法可以检查Bentley.Interop在该级别的开发级别,并且在由主应用程序托管时仍然具有正确的用户控制功能

该工具包由一个加载项应用程序托管,该应用程序又由Microstation托管

using System;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using BCOM = Bentley.Interop.MicroStationDGN;

namespace cds.microstation.win.forms
{
    [DisplayName(@"Point Selector")]
    [Description("Microstation Point Selector.")]
    [ToolboxBitmap(typeof(PointSelector), "PointSelector.bmp")]
    public partial class PointSelector : UserControl
    {
        private BCOM.ApplicationClass BCOM = new BCOM.ApplicationClass();
        private BCOM.Application _ustn = null;                
        public event OnChangedEventHandler OnChanged;

        protected virtual void OnValueChanged(OnChangedEventArgs e)
        {
            if (OnChanged != null)
                OnChanged(this, e);
        }

        public PointSelector()
        {
            InitializeComponent();
        }      

        public static BCOM.Point3d point3D { get; set; }

        private void btnPointSelector_Click(object sender, EventArgs e)
        {           
            _ustn = BCOM;
            ClsPointSelector pointSelector = new ClsPointSelector();
            _ustn.CommandState.StartLocate(pointSelector);                       
         }    
    }

    class ClsPointSelector : ILocateCommandEvents
    {    
        private ApplicationClass BCOM = new ApplicationClass();
        private Application _ustn = null;

        public void Start()
        {
            _ustn = BCOM;
            _ustn.ShowCommand("");
            _ustn.ShowPrompt("Select Data Point");
            _ustn.CommandState.SetLocateCursor();                           
        }

        public void LocateReset()
        {
            _ustn = BCOM;
            _ustn.CommandState.StartDefaultCommand();           
        }

        public void LocateFilter(Element element, ref Point3d point3D, ref bool accepted)
        {          
            accepted = true;
        }

        public void Accept(Element element, ref Point3d point3D, View view)
        {
            PointSelector.point3D = point3D;
        }

        public void LocateFailed()
        {
            // required for interface
        }

        public void Dynamics(ref Point3d point, View view, MsdDrawingMode drawMode)
        {
            // required for interface
        }

        public void Cleanup()
        {
            // required for interface
        }
    }    
}