AllisterRegdarCrowley
AllisterRegdarCrowley

Reputation: 17

GLControl is not showing up in toolbox

For a Computer Graphics class in school I have been assigned to use a GLControl in my project. I have downloaded and installed OpenTK and OpenTK.GLControl. Both of the references appear within my project references tab in solution explorer. I have been trying to find out how to add the GLControl to my toolbox.

The things I have tried.

  1. I have done the tools -> choose toolbox tools -> (select GLControl) but it isn't there to select to add to toolbox
  2. I have attempted to drag the reference of the tool to the toolbar as someone suggested doing on the web.
  3. I have uninstalled my nuget packages and reinstalled them.
  4. Crying for hours and hoping that it works.

What if anything is there that I can do to make this work as I am unable to get anywhere without this control.

Upvotes: 1

Views: 1718

Answers (2)

user7254612
user7254612

Reputation: 1

Compile your project first.

VS's designer doesn't compete with methods and stuff that haven't been verfied to run first.

[Edit:] I had a notification saying my answer is not clear enough. Not sure what's not clear in "just compile your project first". Visual Studio's Designer components are updated after you generated your solution. That is necessary so the Designer reacts exactly the same as when your Form and Components are showing/reacting at runtime. That's all.

Upvotes: 0

BlueMonkMN
BlueMonkMN

Reputation: 25601

As the author of an IDE that makes heavy use of OpenTK's GLControl (SGDK2) I can tell you that I never put the GLControl in the toolbox, and I don't think I would want to. It's not exactly the kind of control you want to deal with at design time. Instead I simply added a dummy control (a Panel) to my form, then went into the designer code file (Form1.Designer.cs, for example) and replaced every occurrence of System.Windows.Forms.Panel with OpenTK.GLControl. Pretty much everything I do with the control is in code, so the designer integration isn't that important anyway.

  /// <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;

EDIT:

That said, I did just try right-clicking on the General section of the Toolbox, selecting "Choose Items..." and browsing to the location of OpenTK.GLControl.dll. This added GLControl to the General category in my toolbox. So I'm not sure why you would be having difficulty. But hopefully forcing it onto a form as shown above will either get it into your project anyway or give you a better error or explanation about why it's not working with your project.

Upvotes: 0

Related Questions