Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / C#

ActionMenuStrip<T>/OptionMenuStrip<T>: Generic MenuStrips Configured by an Enum T

Rate me:
Please Sign up or sign in to vote.
3.89/5 (8 votes)
7 Jun 2006CPOL3 min read 46.1K   362   32  
MenuStrips automatically filled using enums as templates.
namespace OC.Windows.Forms
{
    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.chkUseEnumNames = new System.Windows.Forms.CheckBox();
            this.btCreate = new System.Windows.Forms.Button();
            this.chkIncludeZero = new System.Windows.Forms.CheckBox();
            this.chkCancelClosing = new System.Windows.Forms.CheckBox();
            this.btShow = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.chkAddOther = new System.Windows.Forms.CheckBox();
            this.SuspendLayout();
            // 
            // chkUseEnumNames
            // 
            this.chkUseEnumNames.AutoSize = true;
            this.chkUseEnumNames.Location = new System.Drawing.Point(23, 62);
            this.chkUseEnumNames.Name = "chkUseEnumNames";
            this.chkUseEnumNames.Size = new System.Drawing.Size(171, 17);
            this.chkUseEnumNames.TabIndex = 21;
            this.chkUseEnumNames.Text = "Use enum names as menu text";
            this.chkUseEnumNames.UseVisualStyleBackColor = true;
            this.chkUseEnumNames.CheckedChanged += new System.EventHandler(this.Com_CheckedChanged);
            // 
            // btCreate
            // 
            this.btCreate.Location = new System.Drawing.Point(23, 12);
            this.btCreate.Name = "btCreate";
            this.btCreate.Size = new System.Drawing.Size(111, 21);
            this.btCreate.TabIndex = 20;
            this.btCreate.Text = "Create Menu";
            this.btCreate.UseVisualStyleBackColor = true;
            this.btCreate.Click += new System.EventHandler(this.btCreate_Click);
            // 
            // chkIncludeZero
            // 
            this.chkIncludeZero.AutoSize = true;
            this.chkIncludeZero.Location = new System.Drawing.Point(23, 39);
            this.chkIncludeZero.Name = "chkIncludeZero";
            this.chkIncludeZero.Size = new System.Drawing.Size(86, 17);
            this.chkIncludeZero.TabIndex = 19;
            this.chkIncludeZero.Text = "Include Zero";
            this.chkIncludeZero.UseVisualStyleBackColor = true;
            this.chkIncludeZero.CheckedChanged += new System.EventHandler(this.Com_CheckedChanged);
            // 
            // chkCancelClosing
            // 
            this.chkCancelClosing.AutoSize = true;
            this.chkCancelClosing.Location = new System.Drawing.Point(23, 167);
            this.chkCancelClosing.Name = "chkCancelClosing";
            this.chkCancelClosing.Size = new System.Drawing.Size(143, 17);
            this.chkCancelClosing.TabIndex = 18;
            this.chkCancelClosing.Text = "Cancel closing on check";
            this.chkCancelClosing.UseVisualStyleBackColor = true;
            this.chkCancelClosing.CheckedChanged += new System.EventHandler(this.chkCancelClosing_CheckedChanged);
            // 
            // btShow
            // 
            this.btShow.Enabled = false;
            this.btShow.Location = new System.Drawing.Point(23, 140);
            this.btShow.Name = "btShow";
            this.btShow.Size = new System.Drawing.Size(111, 21);
            this.btShow.TabIndex = 17;
            this.btShow.Text = "Show Menu";
            this.btShow.UseVisualStyleBackColor = true;
            this.btShow.Click += new System.EventHandler(this.btShow_Click);
            // 
            // label1
            // 
            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.label1.Location = new System.Drawing.Point(-2, 196);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(212, 28);
            this.label1.TabIndex = 23;
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // chkAddOther
            // 
            this.chkAddOther.AutoSize = true;
            this.chkAddOther.Location = new System.Drawing.Point(23, 85);
            this.chkAddOther.Name = "chkAddOther";
            this.chkAddOther.Size = new System.Drawing.Size(128, 17);
            this.chkAddOther.TabIndex = 24;
            this.chkAddOther.Text = "Add other menu items";
            this.chkAddOther.UseVisualStyleBackColor = true;
            this.chkAddOther.CheckedChanged += new System.EventHandler(this.Com_CheckedChanged);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(211, 225);
            this.Controls.Add(this.chkAddOther);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.chkUseEnumNames);
            this.Controls.Add(this.btCreate);
            this.Controls.Add(this.chkIncludeZero);
            this.Controls.Add(this.chkCancelClosing);
            this.Controls.Add(this.btShow);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            this.Name = "Form1";
            this.Text = "Test ActionMenuStrip";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.CheckBox chkUseEnumNames;
        private System.Windows.Forms.Button btCreate;
        private System.Windows.Forms.CheckBox chkIncludeZero;
        private System.Windows.Forms.CheckBox chkCancelClosing;
        private System.Windows.Forms.Button btShow;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.CheckBox chkAddOther;
    }
}

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
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions