简体   繁体   中英

adding GLcontrol to visual studio toolbox

maybe the question is simple but I'm using OpenTK with WinForms , the problem is I can't find GLcontrol in the toolbox , so I added it manually in Form1.Designer.cs , this is the code #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        glcontrol1 = new OpenTK.GLControl();
        this.SuspendLayout();
        // 
        // glControl1
        // 

        // 
        // Form1
        // 
        this.Controls.Add(glcontrol1);
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(584, 561);     
        this.Name = "Form1";
        this.Text = "Form1";
        this.Load += new System.EventHandler(this.Form1_Load);
        this.ResumeLayout(false);

    }

    #endregion
    OpenTK.GLControl glcontrol1;

the problem is when I open Form1 in design mode , It shows these messages "could not load type OpenTK.ToolkitOptions from assembly ..." "the variable glcontrol1 is either undeclared or not assigned " I'd like a way to add GLcontrol to toolbox , anyone knows how ?

Double check your project references, you need both OpenTK.dll and OpenTK.GLControl.dll .

Adding GLControl to the WinForms toolbox is covered under "Building a Windows.Forms + GLControl based application" in the documentation.

To begin with, create a Form on which you will place your GLControl. Right click in some empty space of the Toolbox, pick "Choose Items..." and browse for OpenTK.GLControl.dll . Make sure you can find the "GLControl" listed in the ".NET Framework Components", as in the image below.

将GLControl添加到工具箱中

Then you can add the GLControl to your form as any .NET control. A GLControl named glControl1 will be added to your Form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM