Пример #1
0
        private void BrowserForm_Load(object sender, EventArgs e)
        {
            //��ü����ĵ���������һ���ĵ�����
            Inventor.Document doc;
            doc = m_inventorApplication.ActiveDocument;

            //���ӵ��ĵ��¼���������Ӧ�ĵ��ر�
            docEvents = doc.DocumentEvents;

            //ʹ�������ؼ������µ����������
            browserPane = doc.BrowserPanes.Add("Calendar", "MSCAL.Calendar");

            //���õ������ؼ�������
            calCtrl = (MSACAL.Calendar)browserPane.Control;

            //���������ؼ���ʾ��ǰ����
            calCtrl.Today();

            //ʹ�´����Ϊ�����
            browserPane.Activate();

            calCtrl.Click += new MSACAL.DCalendarEvents_ClickEventHandler(calCtrl_Click);
        }
        /// <summary>
        /// when [ActiveXBrowser] button is clicked
        /// </summary>
        /// <param name="Context"></param>
        /// <remarks></remarks>

        private void m_ActiveXBrowser_OnExecute(Inventor.NameValueMap Context)
        {
            //get active document
            Document oDoc = m_inventorApplication.ActiveDocument;

            //get the BrowserPanes
            BrowserPanes oPanes = default(BrowserPanes);

            oPanes = oDoc.BrowserPanes;

            //add the BrowserPane with the control
            BrowserPane oPane = default(BrowserPane);

            oPane = oPanes.Add("MyActiveXPane", "BrowserSample.UserControl1");

            //get the control
            m_ActiveX = (UserControl1)oPane.Control;

            //call a method of the control
            m_ActiveX.DrawASketchRectangle(m_inventorApplication);

            //activate the BrowserPane
            oPane.Activate();
        }