Click here to Skip to main content
15,897,704 members
Articles / Multimedia / GDI+

Appearance Customizable ComboBox

Rate me:
Please Sign up or sign in to vote.
3.50/5 (5 votes)
27 Mar 20072 min read 91.5K   7.1K   24  
A class implementing .Net ComboBox Control that allows appearance customization.
namespace CustomComboBoxDemo
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (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.customComboBox1 = new Eugenis.CustomComboBox();
            this.customComboBox2 = new Eugenis.CustomComboBox();
            this.customComboBox3 = new Eugenis.CustomComboBox();
            this.customComboBox4 = new Eugenis.CustomComboBox();
            this.customComboBox5 = new Eugenis.CustomComboBox();
            this.customComboBox6 = new Eugenis.CustomComboBox();
            this.customComboBox7 = new Eugenis.CustomComboBox();
            this.customComboBox8 = new Eugenis.CustomComboBox();
            this.customComboBox9 = new Eugenis.CustomComboBox();
            this.customComboBox10 = new Eugenis.CustomComboBox();
            this.customComboBox11 = new Eugenis.CustomComboBox();
            this.customComboBox12 = new Eugenis.CustomComboBox();
            this.customComboBox13 = new Eugenis.CustomComboBox();
            this.customComboBox14 = new Eugenis.CustomComboBox();
            this.customComboBox15 = new Eugenis.CustomComboBox();
            this.customComboBox16 = new Eugenis.CustomComboBox();
            this.SuspendLayout();
            // 
            // customComboBox1
            // 
            this.customComboBox1.FormattingEnabled = true;
            this.customComboBox1.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox1.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox1.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox1.Location = new System.Drawing.Point(12, 12);
            this.customComboBox1.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox1.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox1.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox1.Name = "customComboBox1";
            this.customComboBox1.Size = new System.Drawing.Size(121, 21);
            this.customComboBox1.TabIndex = 0;
            this.customComboBox1.UseGotFocusStyle = true;
            this.customComboBox1.UseLostFocusStyle = true;
            // 
            // customComboBox2
            // 
            this.customComboBox2.FormattingEnabled = true;
            this.customComboBox2.GotFocusBorderColor = System.Drawing.Color.Teal;
            this.customComboBox2.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox2.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Normal;
            this.customComboBox2.Location = new System.Drawing.Point(12, 39);
            this.customComboBox2.LostFocusBorderColor = System.Drawing.Color.White;
            this.customComboBox2.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox2.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Normal;
            this.customComboBox2.Name = "customComboBox2";
            this.customComboBox2.Size = new System.Drawing.Size(121, 21);
            this.customComboBox2.TabIndex = 1;
            this.customComboBox2.UseGotFocusStyle = true;
            this.customComboBox2.UseLostFocusStyle = true;
            // 
            // customComboBox3
            // 
            this.customComboBox3.FormattingEnabled = true;
            this.customComboBox3.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox3.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox3.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox3.Location = new System.Drawing.Point(12, 66);
            this.customComboBox3.LostFocusBorderColor = System.Drawing.Color.CadetBlue;
            this.customComboBox3.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox3.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox3.Name = "customComboBox3";
            this.customComboBox3.Size = new System.Drawing.Size(121, 21);
            this.customComboBox3.TabIndex = 2;
            this.customComboBox3.UseGotFocusStyle = true;
            this.customComboBox3.UseLostFocusStyle = true;
            // 
            // customComboBox4
            // 
            this.customComboBox4.FormattingEnabled = true;
            this.customComboBox4.GotFocusBorderColor = System.Drawing.Color.SaddleBrown;
            this.customComboBox4.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox4.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox4.Location = new System.Drawing.Point(12, 93);
            this.customComboBox4.LostFocusBorderColor = System.Drawing.Color.SaddleBrown;
            this.customComboBox4.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Outset;
            this.customComboBox4.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Normal;
            this.customComboBox4.Name = "customComboBox4";
            this.customComboBox4.Size = new System.Drawing.Size(121, 21);
            this.customComboBox4.TabIndex = 3;
            this.customComboBox4.UseGotFocusStyle = true;
            this.customComboBox4.UseLostFocusStyle = true;
            // 
            // customComboBox5
            // 
            this.customComboBox5.FormattingEnabled = true;
            this.customComboBox5.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox5.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox5.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox5.Location = new System.Drawing.Point(12, 120);
            this.customComboBox5.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox5.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox5.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox5.Name = "customComboBox5";
            this.customComboBox5.Size = new System.Drawing.Size(121, 21);
            this.customComboBox5.TabIndex = 4;
            this.customComboBox5.UseGotFocusStyle = true;
            this.customComboBox5.UseLostFocusStyle = true;
            // 
            // customComboBox6
            // 
            this.customComboBox6.FormattingEnabled = true;
            this.customComboBox6.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox6.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox6.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox6.Location = new System.Drawing.Point(12, 147);
            this.customComboBox6.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox6.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox6.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox6.Name = "customComboBox6";
            this.customComboBox6.Size = new System.Drawing.Size(121, 21);
            this.customComboBox6.TabIndex = 5;
            this.customComboBox6.UseGotFocusStyle = true;
            this.customComboBox6.UseLostFocusStyle = true;
            // 
            // customComboBox7
            // 
            this.customComboBox7.FormattingEnabled = true;
            this.customComboBox7.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox7.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox7.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox7.Location = new System.Drawing.Point(12, 174);
            this.customComboBox7.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox7.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox7.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox7.Name = "customComboBox7";
            this.customComboBox7.Size = new System.Drawing.Size(121, 21);
            this.customComboBox7.TabIndex = 6;
            this.customComboBox7.UseGotFocusStyle = true;
            this.customComboBox7.UseLostFocusStyle = true;
            // 
            // customComboBox8
            // 
            this.customComboBox8.FormattingEnabled = true;
            this.customComboBox8.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox8.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox8.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox8.Location = new System.Drawing.Point(12, 201);
            this.customComboBox8.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox8.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox8.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox8.Name = "customComboBox8";
            this.customComboBox8.Size = new System.Drawing.Size(121, 21);
            this.customComboBox8.TabIndex = 7;
            this.customComboBox8.UseGotFocusStyle = true;
            this.customComboBox8.UseLostFocusStyle = true;
            // 
            // customComboBox9
            // 
            this.customComboBox9.FormattingEnabled = true;
            this.customComboBox9.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox9.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox9.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox9.Location = new System.Drawing.Point(139, 201);
            this.customComboBox9.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox9.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox9.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox9.Name = "customComboBox9";
            this.customComboBox9.Size = new System.Drawing.Size(121, 21);
            this.customComboBox9.TabIndex = 15;
            this.customComboBox9.UseGotFocusStyle = true;
            this.customComboBox9.UseLostFocusStyle = true;
            // 
            // customComboBox10
            // 
            this.customComboBox10.FormattingEnabled = true;
            this.customComboBox10.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox10.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox10.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox10.Location = new System.Drawing.Point(139, 174);
            this.customComboBox10.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox10.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox10.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox10.Name = "customComboBox10";
            this.customComboBox10.Size = new System.Drawing.Size(121, 21);
            this.customComboBox10.TabIndex = 14;
            this.customComboBox10.UseGotFocusStyle = true;
            this.customComboBox10.UseLostFocusStyle = true;
            // 
            // customComboBox11
            // 
            this.customComboBox11.FormattingEnabled = true;
            this.customComboBox11.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox11.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox11.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox11.Location = new System.Drawing.Point(139, 147);
            this.customComboBox11.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox11.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox11.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox11.Name = "customComboBox11";
            this.customComboBox11.Size = new System.Drawing.Size(121, 21);
            this.customComboBox11.TabIndex = 13;
            this.customComboBox11.UseGotFocusStyle = true;
            this.customComboBox11.UseLostFocusStyle = true;
            // 
            // customComboBox12
            // 
            this.customComboBox12.FormattingEnabled = true;
            this.customComboBox12.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox12.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox12.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox12.Location = new System.Drawing.Point(139, 120);
            this.customComboBox12.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox12.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox12.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox12.Name = "customComboBox12";
            this.customComboBox12.Size = new System.Drawing.Size(121, 21);
            this.customComboBox12.TabIndex = 12;
            this.customComboBox12.UseGotFocusStyle = true;
            this.customComboBox12.UseLostFocusStyle = true;
            // 
            // customComboBox13
            // 
            this.customComboBox13.FormattingEnabled = true;
            this.customComboBox13.GotFocusBorderColor = System.Drawing.Color.SaddleBrown;
            this.customComboBox13.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox13.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox13.Location = new System.Drawing.Point(139, 93);
            this.customComboBox13.LostFocusBorderColor = System.Drawing.Color.SaddleBrown;
            this.customComboBox13.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Outset;
            this.customComboBox13.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Normal;
            this.customComboBox13.Name = "customComboBox13";
            this.customComboBox13.Size = new System.Drawing.Size(121, 21);
            this.customComboBox13.TabIndex = 11;
            this.customComboBox13.UseGotFocusStyle = true;
            this.customComboBox13.UseLostFocusStyle = true;
            // 
            // customComboBox14
            // 
            this.customComboBox14.FormattingEnabled = true;
            this.customComboBox14.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox14.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox14.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox14.Location = new System.Drawing.Point(139, 66);
            this.customComboBox14.LostFocusBorderColor = System.Drawing.Color.CadetBlue;
            this.customComboBox14.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox14.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox14.Name = "customComboBox14";
            this.customComboBox14.Size = new System.Drawing.Size(121, 21);
            this.customComboBox14.TabIndex = 10;
            this.customComboBox14.UseGotFocusStyle = true;
            this.customComboBox14.UseLostFocusStyle = true;
            // 
            // customComboBox15
            // 
            this.customComboBox15.FormattingEnabled = true;
            this.customComboBox15.GotFocusBorderColor = System.Drawing.Color.Teal;
            this.customComboBox15.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox15.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Normal;
            this.customComboBox15.Location = new System.Drawing.Point(139, 39);
            this.customComboBox15.LostFocusBorderColor = System.Drawing.Color.White;
            this.customComboBox15.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox15.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Normal;
            this.customComboBox15.Name = "customComboBox15";
            this.customComboBox15.Size = new System.Drawing.Size(121, 21);
            this.customComboBox15.TabIndex = 9;
            this.customComboBox15.UseGotFocusStyle = true;
            this.customComboBox15.UseLostFocusStyle = true;
            // 
            // customComboBox16
            // 
            this.customComboBox16.FormattingEnabled = true;
            this.customComboBox16.GotFocusBorderColor = System.Drawing.Color.Black;
            this.customComboBox16.GotFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox16.GotFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Original;
            this.customComboBox16.Location = new System.Drawing.Point(139, 12);
            this.customComboBox16.LostFocusBorderColor = System.Drawing.Color.Gray;
            this.customComboBox16.LostFocusBorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
            this.customComboBox16.LostFocusDropDownButtonState = Eugenis.CustomComboBox.EugenisButtonState.Flat;
            this.customComboBox16.Name = "customComboBox16";
            this.customComboBox16.Size = new System.Drawing.Size(121, 21);
            this.customComboBox16.TabIndex = 8;
            this.customComboBox16.UseGotFocusStyle = true;
            this.customComboBox16.UseLostFocusStyle = true;
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Controls.Add(this.customComboBox9);
            this.Controls.Add(this.customComboBox10);
            this.Controls.Add(this.customComboBox11);
            this.Controls.Add(this.customComboBox12);
            this.Controls.Add(this.customComboBox13);
            this.Controls.Add(this.customComboBox14);
            this.Controls.Add(this.customComboBox15);
            this.Controls.Add(this.customComboBox16);
            this.Controls.Add(this.customComboBox8);
            this.Controls.Add(this.customComboBox7);
            this.Controls.Add(this.customComboBox6);
            this.Controls.Add(this.customComboBox5);
            this.Controls.Add(this.customComboBox4);
            this.Controls.Add(this.customComboBox3);
            this.Controls.Add(this.customComboBox2);
            this.Controls.Add(this.customComboBox1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);

        }

        #endregion

        private Eugenis.CustomComboBox customComboBox1;
        private Eugenis.CustomComboBox customComboBox2;
        private Eugenis.CustomComboBox customComboBox3;
        private Eugenis.CustomComboBox customComboBox4;
        private Eugenis.CustomComboBox customComboBox5;
        private Eugenis.CustomComboBox customComboBox6;
        private Eugenis.CustomComboBox customComboBox7;
        private Eugenis.CustomComboBox customComboBox8;
        private Eugenis.CustomComboBox customComboBox9;
        private Eugenis.CustomComboBox customComboBox10;
        private Eugenis.CustomComboBox customComboBox11;
        private Eugenis.CustomComboBox customComboBox12;
        private Eugenis.CustomComboBox customComboBox13;
        private Eugenis.CustomComboBox customComboBox14;
        private Eugenis.CustomComboBox customComboBox15;
        private Eugenis.CustomComboBox customComboBox16;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Singapore Singapore
Ng Pei Jiun, Eugenis, graduated from National University of Singapore. After worked for one year as VB .NET and C# .NET programmer, I had decided to do freelancing in order to experience more about SDLC and Project Management.

I am currently unemployed and having intermediate skill in C# .NET programming.

Comments and Discussions