c#-numericupdown-Digital Selection---Shinepans

Source: Internet
Author: User

Program.cs

Using system;using system.collections.generic;using system.linq;using system.windows.forms;namespace NumChoose{    Static Class    program {//<summary>///        Main entry point for application. //        </summary>        [STAThread]        static void Main ()        {            application.enablevisualstyles ();            Application.setcompatibletextrenderingdefault (false);            Application.Run (New Form1 ());            DecimalPlaces the decimal number to display in the Number display box            //hexadeccimal Indicates whether a number displays the value included in hexadecimal format            //increment When you click the button up or down. The increment or decrement value of the            //interceptarrowkeys indicates whether the user can use the UP or DOWN ARROW keys to select a value            //maximum the maximum value of the display box            //minumum Show box Minimum consent value            // The value displayed in the value NumericUpDown space//updownalign the alignment of the            button up or down in the display box            //downbutton decrease the values in the number display box            //upbutton Add the value in the Number Display box        }}    }

Form1.cs:

Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using system.linq;using system.text;using system.windows.forms;namespace numchoose{public    partial class Form1: Form    {public        Form1 ()        {            InitializeComponent ();        }        private void Form1_Load (object sender, EventArgs e)        {            numericupdown1.minimum = 1;  Set minimum value 1            numericupdown1.maximum =;  Set the maximum value of            numericupdown1.decimalplaces = 2;//Set the Decimaplaces property of the space so that the space value is displayed            after the decimal point two digits Numericupdown1.increment = 1; Set increment or decrement            Numericupdown1.interceptarrowkeys = true;//Set the user to be able to select the value by the UP, DOWN ARROW key        }        private void Numericupdown1_valuechanged (object sender, EventArgs e)        {            Label2. Text = "The selected value is:" + Numericupdown1.value;}}    }

Form1 Design:

Namespace numchoose{partial class Form1 {//<summary>////Required designer variables.        </summary> private System.ComponentModel.IContainer components = null;        <summary>///clean up all resources in use. </summary>//<param name= "disposing" > assumes that the managed resource should be released as true; otherwise false. </param> protected override void Dispose (bool disposing) {if (disposing && (compon Ents = null)) {components.            Dispose (); } base.        Dispose (disposing);        #region the code generated by the Windows window Designer///<summary>///designer supports the required method-do not///Use the Code Editor to change the contents of this method. </summary> private void InitializeComponent () {this.numericupdown1 = new System.wi Ndows.            Forms.numericupdown ();            This.label1 = new System.Windows.Forms.Label ();            This.label2 = new System.Windows.Forms.Label (); ((System.componentmodel.isupportinitialize) (THIS.NUMERICUPDOWN1)).            BeginInit (); This.            SuspendLayout (); NUMERICUPDOWN1//this.numericUpDown1.Location = new System.Drawing.Point (102, 22            );            This.numericUpDown1.Name = "NumericUpDown1";            This.numericUpDown1.Size = new System.Drawing.Size (120, 21);            This.numericUpDown1.TabIndex = 0;            This.numericUpDown1.ValueChanged + = new System.EventHandler (this.numericupdown1_valuechanged);            Label1//this.label1.AutoSize = true;            This.label1.Location = new System.Drawing.Point (37, 26);            This.label1.Name = "Label1";            This.label1.Size = new System.Drawing.Size (59, 12);            This.label1.TabIndex = 1;            This.label1.Text = "SELECT number:";            Label2//this.label2.AutoSize = true; This.label2.Location = new System.Drawing.Point (37, 62);            This.label2.Name = "Label2";            This.label2.Size = new System.Drawing.Size (0, 12);            This.label2.TabIndex = 2; Form1//this.            Autoscaledimensions = new System.Drawing.SizeF (6F, 12F); This.            AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; This.            ClientSize = new System.Drawing.Size (305, 121); This.            Controls.Add (THIS.LABEL2); This.            Controls.Add (THIS.LABEL1); This.            Controls.Add (THIS.NUMERICUPDOWN1); This.            Name = "Form1"; This.            Text = "Digital Selection"; This. Load + = new System.EventHandler (this.            Form1_Load); ((System.ComponentModel.ISupportInitialize) (THIS.NUMERICUPDOWN1)).            EndInit (); This.            ResumeLayout (FALSE); This.        PerformLayout ();        } #endregion private System.Windows.Forms.NumericUpDown numericUpDown1;        Private System.Windows.Forms.Label Label1; Private System.windoWs.    Forms.label Label2; }}


c#-numericupdown-Digital Selection---Shinepans

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.