I am trying to use the component below in my vb.net program
What I'm having troubles with is errors saying SuspendLayout
is not a member of FlatTabControl.FlatTabControl
, and even with Controls
not being a member of FlatTabControl
.
Anyone know how to fix this?
Below is the C# code which I converted to VB.Net code, still can't get it working.
Cheers.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace TabControlTest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private FlatTabControl.FlatTabControl tabControl1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TabPage tabPage4;
private System.ComponentModel.IContainer components;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#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()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.tabControl1 = new FlatTabControl.FlatTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.ImageList = this.imageList1;
this.tabControl1.Location = new System.Drawing.Point(8, 16);
this.tabControl1.myBackColor = System.Drawing.SystemColors.Control;
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 2;
this.tabControl1.Size = new System.Drawing.Size(328, 240);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
this.tabPage1.ImageIndex = 0;
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(320, 211);
this.tabPage1.TabIndex = 1;
this.tabPage1.Text = "tabPage1";
//
// tabPage2
//
this.tabPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.tabPage2.ImageIndex = 1;
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(192, 71);
this.tabPage2.TabIndex = 0;
this.tabPage2.Text = "tabPage2";
//
// tabPage3
//
this.tabPage3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
this.tabPage3.ImageIndex = 2;
this.tabPage3.Location = new System.Drawing.Point(4, 25);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(192, 71);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "tabPage3";
//
// tabPage4
//
this.tabPage4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
this.tabPage4.ImageIndex = 0;
this.tabPage4.Location = new System.Drawing.Point(4, 25);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(192, 71);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "tabPage4";
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "");
this.imageList1.Images.SetKeyName(1, "");
this.imageList1.Images.SetKeyName(2, "");
//
// button2
//
this.button2.Location = new System.Drawing.Point(352, 160);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Add";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(352, 208);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 3;
this.button3.Text = "Remove";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(448, 269);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.tabControl1);
this.Name = "Form1";
this.Text = "FlatTabControl test";
this.Load += new System.EventHandler(this.Form1_Load);
this.tabControl1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private static int nt = 0;
private void button2_Click(object sender, System.EventArgs e)
{
TabPage tabPage = new System.Windows.Forms.TabPage("newTab");
switch (nt)
{
case 0:
{
tabPage.BackColor = Color.LightCoral;
tabPage.ImageIndex = 0;
nt = 1;
}
break;
case 1:
{
tabPage.BackColor = Color.LightGoldenrodYellow;
tabPage.ImageIndex = 1;
nt = 2;
}
break;
case 2:
{
tabPage.BackColor = Color.LightSeaGreen;
tabPage.ImageIndex = 2;
nt = 0;
}
break;
}
tabControl1.TabPages.Add(tabPage);
}
private void button3_Click(object sender, System.EventArgs e)
{
tabControl1.TabPages.RemoveAt(tabControl1.SelectedIndex);
}
private void tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
MessageBox.Show("1");
}
}
}