Click here to Skip to main content
15,888,527 members
Articles / Programming Languages / C#

Key-Value Pairs as Enum-Constants

Rate me:
Please Sign up or sign in to vote.
4.33/5 (7 votes)
7 Sep 2008CPOL3 min read 61.9K   213   19  
An enum-like class that supports flags (up to 8192), has additional value-type data, description, and FastSerializer support.
namespace Dialogik.Utils.Defines.Test
{
    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.listColor = new System.Windows.Forms.ListBox();
            this.listValue = new System.Windows.Forms.ListBox();
            this.listName = new System.Windows.Forms.ListBox();
            this.listDescr = new System.Windows.Forms.ListBox();
            this.label1 = new System.Windows.Forms.Label();
            this.textResult = new System.Windows.Forms.TextBox();
            this.btClear = new System.Windows.Forms.Button();
            this.btAdd = new System.Windows.Forms.Button();
            this.btSub = new System.Windows.Forms.Button();
            this.label2 = new System.Windows.Forms.Label();
            this.listResult = new System.Windows.Forms.CheckedListBox();
            this.listAction = new System.Windows.Forms.CheckedListBox();
            this.btWrite = new System.Windows.Forms.Button();
            this.btRead = new System.Windows.Forms.Button();
            this.textBinary = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.textBytes = new System.Windows.Forms.TextBox();
            this.btLoad = new System.Windows.Forms.Button();
            this.btSave = new System.Windows.Forms.Button();
            this.textTest = new System.Windows.Forms.TextBox();
            this.btSet1 = new System.Windows.Forms.Button();
            this.btSet2 = new System.Windows.Forms.Button();
            this.btSet3 = new System.Windows.Forms.Button();
            this.btSet4 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // listColor
            // 
            this.listColor.Enabled = false;
            this.listColor.FormattingEnabled = true;
            this.listColor.Location = new System.Drawing.Point(268, 53);
            this.listColor.Name = "listColor";
            this.listColor.SelectionMode = System.Windows.Forms.SelectionMode.None;
            this.listColor.Size = new System.Drawing.Size(120, 121);
            this.listColor.TabIndex = 1;
            // 
            // listValue
            // 
            this.listValue.Enabled = false;
            this.listValue.FormattingEnabled = true;
            this.listValue.Location = new System.Drawing.Point(16, 53);
            this.listValue.Name = "listValue";
            this.listValue.SelectionMode = System.Windows.Forms.SelectionMode.None;
            this.listValue.Size = new System.Drawing.Size(120, 121);
            this.listValue.TabIndex = 2;
            // 
            // listName
            // 
            this.listName.Enabled = false;
            this.listName.FormattingEnabled = true;
            this.listName.Location = new System.Drawing.Point(142, 53);
            this.listName.Name = "listName";
            this.listName.SelectionMode = System.Windows.Forms.SelectionMode.None;
            this.listName.Size = new System.Drawing.Size(120, 121);
            this.listName.TabIndex = 3;
            // 
            // listDescr
            // 
            this.listDescr.Enabled = false;
            this.listDescr.FormattingEnabled = true;
            this.listDescr.Location = new System.Drawing.Point(394, 53);
            this.listDescr.Name = "listDescr";
            this.listDescr.SelectionMode = System.Windows.Forms.SelectionMode.None;
            this.listDescr.Size = new System.Drawing.Size(240, 121);
            this.listDescr.TabIndex = 4;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(13, 33);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(85, 13);
            this.label1.TabIndex = 11;
            this.label1.Text = "Available Enums";
            // 
            // textResult
            // 
            this.textResult.Location = new System.Drawing.Point(268, 272);
            this.textResult.Name = "textResult";
            this.textResult.ReadOnly = true;
            this.textResult.Size = new System.Drawing.Size(120, 20);
            this.textResult.TabIndex = 12;
            // 
            // btClear
            // 
            this.btClear.Location = new System.Drawing.Point(208, 270);
            this.btClear.Name = "btClear";
            this.btClear.Size = new System.Drawing.Size(54, 23);
            this.btClear.TabIndex = 13;
            this.btClear.Text = "clear";
            this.btClear.UseVisualStyleBackColor = true;
            this.btClear.Click += new System.EventHandler(this.btClear_Click);
            // 
            // btAdd
            // 
            this.btAdd.Location = new System.Drawing.Point(142, 270);
            this.btAdd.Name = "btAdd";
            this.btAdd.Size = new System.Drawing.Size(27, 23);
            this.btAdd.TabIndex = 14;
            this.btAdd.Text = "+";
            this.btAdd.UseVisualStyleBackColor = true;
            this.btAdd.Click += new System.EventHandler(this.btAdd_Click);
            // 
            // btSub
            // 
            this.btSub.Location = new System.Drawing.Point(175, 270);
            this.btSub.Name = "btSub";
            this.btSub.Size = new System.Drawing.Size(27, 23);
            this.btSub.TabIndex = 15;
            this.btSub.Text = "-";
            this.btSub.UseVisualStyleBackColor = true;
            this.btSub.Click += new System.EventHandler(this.btSub_Click);
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(13, 218);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(47, 13);
            this.label2.TabIndex = 16;
            this.label2.Text = "Example";
            // 
            // listResult
            // 
            this.listResult.CheckOnClick = true;
            this.listResult.FormattingEnabled = true;
            this.listResult.Location = new System.Drawing.Point(268, 352);
            this.listResult.Name = "listResult";
            this.listResult.Size = new System.Drawing.Size(120, 184);
            this.listResult.TabIndex = 17;
            this.listResult.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.listResult_ItemCheck);
            // 
            // listAction
            // 
            this.listAction.CheckOnClick = true;
            this.listAction.FormattingEnabled = true;
            this.listAction.Location = new System.Drawing.Point(16, 272);
            this.listAction.Name = "listAction";
            this.listAction.Size = new System.Drawing.Size(120, 124);
            this.listAction.TabIndex = 18;
            // 
            // btWrite
            // 
            this.btWrite.Location = new System.Drawing.Point(235, 487);
            this.btWrite.Name = "btWrite";
            this.btWrite.Size = new System.Drawing.Size(27, 23);
            this.btWrite.TabIndex = 19;
            this.btWrite.Text = "<<";
            this.btWrite.UseVisualStyleBackColor = true;
            this.btWrite.Click += new System.EventHandler(this.btWrite_Click);
            // 
            // btRead
            // 
            this.btRead.Location = new System.Drawing.Point(235, 513);
            this.btRead.Name = "btRead";
            this.btRead.Size = new System.Drawing.Size(27, 23);
            this.btRead.TabIndex = 20;
            this.btRead.Text = ">>";
            this.btRead.UseVisualStyleBackColor = true;
            this.btRead.Click += new System.EventHandler(this.btRead_Click);
            // 
            // textBinary
            // 
            this.textBinary.Location = new System.Drawing.Point(16, 494);
            this.textBinary.Multiline = true;
            this.textBinary.Name = "textBinary";
            this.textBinary.ReadOnly = true;
            this.textBinary.Size = new System.Drawing.Size(207, 42);
            this.textBinary.TabIndex = 21;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(13, 256);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(44, 13);
            this.label3.TabIndex = 22;
            this.label3.Text = "Modifier";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(265, 256);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(78, 13);
            this.label4.TabIndex = 23;
            this.label4.Text = "Result Decimal";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(265, 297);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(68, 13);
            this.label5.TabIndex = 24;
            this.label5.Text = "Result Visual";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(13, 478);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(72, 13);
            this.label6.TabIndex = 25;
            this.label6.Text = "Binary Stream";
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(13, 415);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(55, 13);
            this.label7.TabIndex = 29;
            this.label7.Text = "Byte Array";
            // 
            // textBytes
            // 
            this.textBytes.Location = new System.Drawing.Point(16, 431);
            this.textBytes.Name = "textBytes";
            this.textBytes.ReadOnly = true;
            this.textBytes.Size = new System.Drawing.Size(207, 20);
            this.textBytes.TabIndex = 28;
            // 
            // btLoad
            // 
            this.btLoad.Location = new System.Drawing.Point(235, 428);
            this.btLoad.Name = "btLoad";
            this.btLoad.Size = new System.Drawing.Size(27, 23);
            this.btLoad.TabIndex = 27;
            this.btLoad.Text = ">>";
            this.btLoad.UseVisualStyleBackColor = true;
            this.btLoad.Click += new System.EventHandler(this.btLoad_Click);
            // 
            // btSave
            // 
            this.btSave.Location = new System.Drawing.Point(235, 402);
            this.btSave.Name = "btSave";
            this.btSave.Size = new System.Drawing.Size(27, 23);
            this.btSave.TabIndex = 26;
            this.btSave.Text = "<<";
            this.btSave.UseVisualStyleBackColor = true;
            this.btSave.Click += new System.EventHandler(this.btSave_Click);
            // 
            // textTest
            // 
            this.textTest.Location = new System.Drawing.Point(268, 326);
            this.textTest.Name = "textTest";
            this.textTest.Size = new System.Drawing.Size(120, 20);
            this.textTest.TabIndex = 32;
            this.textTest.Text = "sample text";
            // 
            // btSet1
            // 
            this.btSet1.Location = new System.Drawing.Point(430, 352);
            this.btSet1.Name = "btSet1";
            this.btSet1.Size = new System.Drawing.Size(202, 23);
            this.btSet1.TabIndex = 33;
            this.btSet1.Text = "this.eColor = \"eBackground\"";
            this.btSet1.UseVisualStyleBackColor = true;
            this.btSet1.Click += new System.EventHandler(this.btSet1_Click);
            // 
            // btSet2
            // 
            this.btSet2.Location = new System.Drawing.Point(430, 381);
            this.btSet2.Name = "btSet2";
            this.btSet2.Size = new System.Drawing.Size(202, 24);
            this.btSet2.TabIndex = 34;
            this.btSet2.Text = "this.eColor += 2";
            this.btSet2.UseVisualStyleBackColor = true;
            this.btSet2.Click += new System.EventHandler(this.btSet2_Click);
            // 
            // btSet3
            // 
            this.btSet3.Location = new System.Drawing.Point(430, 411);
            this.btSet3.Name = "btSet3";
            this.btSet3.Size = new System.Drawing.Size(202, 24);
            this.btSet3.TabIndex = 35;
            this.btSet3.Text = "this.eColor.Invert()";
            this.btSet3.UseVisualStyleBackColor = true;
            this.btSet3.Click += new System.EventHandler(this.btSet3_Click);
            // 
            // btSet4
            // 
            this.btSet4.Location = new System.Drawing.Point(430, 441);
            this.btSet4.Name = "btSet4";
            this.btSet4.Size = new System.Drawing.Size(202, 24);
            this.btSet4.TabIndex = 36;
            this.btSet4.Text = "this.eColor.MarkAll()";
            this.btSet4.UseVisualStyleBackColor = true;
            this.btSet4.Click += new System.EventHandler(this.btSet4_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(644, 554);
            this.Controls.Add(this.btSet4);
            this.Controls.Add(this.btSet3);
            this.Controls.Add(this.btSet2);
            this.Controls.Add(this.btSet1);
            this.Controls.Add(this.textTest);
            this.Controls.Add(this.label7);
            this.Controls.Add(this.textBytes);
            this.Controls.Add(this.btLoad);
            this.Controls.Add(this.btSave);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.textBinary);
            this.Controls.Add(this.btRead);
            this.Controls.Add(this.btWrite);
            this.Controls.Add(this.listAction);
            this.Controls.Add(this.listResult);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.btSub);
            this.Controls.Add(this.btAdd);
            this.Controls.Add(this.btClear);
            this.Controls.Add(this.textResult);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.listDescr);
            this.Controls.Add(this.listName);
            this.Controls.Add(this.listValue);
            this.Controls.Add(this.listColor);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.ListBox listColor;
        private System.Windows.Forms.ListBox listValue;
        private System.Windows.Forms.ListBox listName;
        private System.Windows.Forms.ListBox listDescr;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox textResult;
        private System.Windows.Forms.Button btClear;
        private System.Windows.Forms.Button btAdd;
        private System.Windows.Forms.Button btSub;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.CheckedListBox listResult;
        private System.Windows.Forms.CheckedListBox listAction;
        private System.Windows.Forms.Button btWrite;
        private System.Windows.Forms.Button btRead;
        private System.Windows.Forms.TextBox textBinary;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.TextBox textBytes;
        private System.Windows.Forms.Button btLoad;
        private System.Windows.Forms.Button btSave;
        private System.Windows.Forms.TextBox textTest;
        private System.Windows.Forms.Button btSet1;
        private System.Windows.Forms.Button btSet2;
        private System.Windows.Forms.Button btSet3;
        private System.Windows.Forms.Button btSet4;
    }
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions