C++使用C#的控件

C++寫上位機調用AxInterop.ActUtlTypeLib.dll.

初始化

namespace plc
{
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        AxActUtlTypeLib::AxActUtlType ^axActUtlType = gcnew AxActUtlTypeLib::AxActUtlType();
        Form1()

        {
              (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->axActUtlType))->BeginInit();
               this->Controls->Add(this->axActUtlType);
              (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->axActUtlType))->EndInit();
        }
    };
}

調用

gcroot<plc::Form1^>*_plc = new gcroot<plc::Form1^>;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章