chr
2025-01-03 31a636e735a0addc56e4f4527f500b7aa0874eb5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//**********************
//Hosting SOLIDWORKS eDrawings control in Windows Presentation Foundation (WPF)
//Copyright(C) 2019 www.codestack.net
//License: https://github.com/codestack-net-dev/solidworks-api-examples/blob/master/LICENSE
//Product URL: https://www.codestack.net/edrawings-api/gettings-started/wpf/
//**********************
 
using EModelView;
using System;
using System.Windows.Forms;
 
namespace PdmSwPlugin.MaterialSelect.EDrawing
{
    public class EDrawingsHost : AxHost
    {
        public event Action<EModelViewControl> ControlLoaded;
 
        private bool m_IsLoaded;
 
        public EDrawingsHost() : base("22945A69-1191-4DCF-9E6F-409BDE94D101")
        {
            m_IsLoaded = false;
        }
 
        protected override void OnCreateControl()
        {
            base.OnCreateControl();
 
            if (!m_IsLoaded)
            {
                m_IsLoaded = true;
                EModelViewControl ctrl = GetOcx() as EModelViewControl;
                ControlLoaded?.Invoke(ctrl);
            }
        }
    }
}