我Win App用.Net 6.
我想將wpf組件添加到我的專案中,但ElementHost在toolbox.
是否已洗掉此控制元件?
如果是,如何將wpf控制元件添加到win應用程式?
uj5u.com熱心網友回復:
看起來 .NET 6 Winform 設計器不支持 ElementHost。
[我的版本是 Visual Studio 2022 17.1.1]

嘗試手動添加 ElementHost
private System.Windows.Forms.Integration.ElementHost elementHost;
private void InitElementHost()
{
this.SuspendLayout();
this.elementHost.Location = new System.Drawing.Point(236, 156); //location
this.elementHost.Name = "elementHost1";
this.elementHost.Size = new System.Drawing.Size(200, 100);
this.elementHost.TabIndex = 0;
this.elementHost.Text = "elementHost1";
this.elementHost.Child = null; //wpf control
this.ResumeLayout(false);
}

轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/458845.html
