1

次のユーザーコントロールを開発しようとしています。

ユーザー コントロールはエラーなしでビルドされます。Visual Studios でツールキットを読み込もうとすると、Visual Studio エラーが表示されます

ファイルまたはアセンブリ「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
        }
    }    
}
4

0 に答える 0