作爲一個大量使用OpenTK的GLControl(SGDK2)的IDE的作者,我可以告訴你,我從來沒有把GLControl放在工具箱中,我不認爲我會這麼想。這不是你想要在設計時處理的那種控制。相反,我只是在表單中添加了一個虛擬控件(Panel),然後進入設計器代碼文件(例如Form1.Designer.cs),並將System.Windows.Forms.Panel
與OpenTK.GLControl
替換爲每個出現的位置。幾乎我用控制器做的每件事都在代碼中,所以設計器集成無論如何不是那麼重要。
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel1 = new OpenTK.GLControl();
this.SuspendLayout();
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(32, 37);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(223, 175);
this.panel1.TabIndex = 0;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private OpenTK.GLControl panel1;
編輯:
這麼說,我也只是嘗試在工具箱的常規部分單擊鼠標右鍵,選擇「選擇項目...」並瀏覽到OpenTK.GLControl的位置.dll文件。這將GLControl添加到我的工具箱中的常規類別中。所以我不確定你爲什麼會遇到困難。但希望將它強制轉換爲上面顯示的表單,無論如何都會將其納入您的項目中,或者爲您提供更好的錯誤或解釋,說明爲什麼它不適用於您的項目。