C#-numericUpDown-数字选择---ShinePans
program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms; namespace NumChoose
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
//DecimalPlaces 数字显示框中要显示的十进制数
//Hexadeccimal 指示数字是否以十六进制格式显示所包括的的值
//Increment 向上或向下单击button时,数字显示框递增或递减的值
//InterceptArrowKeys 指示用户能否够使用向上或向下键选择值
//Maximum 显示框最大值
//Minumum 显示框最小同意值
//Value NumericUpDown 空间中显示的数值
//UpDownAlign 显示框中向上或向下button的对齐方式
//DownButton 减小数字显示框中的值
//UpButton 添加数字显示框中的值
}
}
}
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; //设置最小值1
numericUpDown1.Maximum = 20; //设置最大值20
numericUpDown1.DecimalPlaces = 2; //设置空间的DecimaPlaces属性,使空间的数值小数点后两位显示
numericUpDown1.Increment = 1; //设置递增或递减
numericUpDown1.InterceptArrowKeys = true;//设置用户能够通过向上,向下键选择值 } private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
label2.Text = "选中的数值为: " + numericUpDown1.Value;
}
}
}
Form1设计:
namespace NumChoose
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理全部正在使用的资源。
/// </summary>
/// <param name="disposing">假设应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows 窗口设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器改动此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.numericUpDown1 = new System.Windows.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 = "选择数字:";
//
// 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 = "数字选择";
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-数字选择---ShinePans的更多相关文章
- e789. 限制用JSpinner实现数字选择的值
// Create a number spinner that only handles values in the range [0,100] int min = 0; int max = 100; ...
- 使用shell脚本自定义实现选择登录ssh
在系统bin目录中建立两个脚本分别是pssh tssh pssh #!/usr/bin/expect -f set ip [lindex ] set port [lindex ] set passwo ...
- 1、用datetimepicker插件实现限定时间范围的选择 2、时间插件实现默认当天的时间和只能选择小于今天的日期
一.用datetimepicker插件实现限定时间范围的选择 1.下面是要实现的效果图,让开始时间只能从 2018-7-1 到 2018-7-7 选择. 2.html的结构 <div cla ...
- Android数字选择器-NumberPicker
数字选择器NumberPicker是Android3.0之后引入的一个控件,比较常用,比如说手机常用的闹钟,可以选择小时和分钟,如果你需要兼容3.0之前版本,GitHub上有开源的项目,具体的下载地址 ...
- WindowsForm公共控件--2016年12月5日
Button text:修改按钮显示的文字 CheckBox Checked:是否选中 CheckedListBox checkedListBox.Items.Add(显示的值,初始选中状态); ch ...
- WinRT Toolkit 介绍--Control篇
WinRT toolkit是组针对Windows Runtime XAML开发的一系列Control,extension和helper类.它和Windows Phone Toolkit一样,也是由很多 ...
- winform窗体 控件【公共控件】
Button 按钮 布局 AutoSize 自动匹配尺寸 Location 确定控件位置,相对左上角坐标 Margin 控件与控件之间的距离 Size ...
- c#窗体开发
奇: 常用控件的使用(期间参杂着VS快捷键/常用设置) 快捷键:引用命名空间:shift+alt+F10 断点:F9 调试:F5 逐句调试(每行代码一次跳转):F11 逐过程调试:F10 重构提取方法 ...
- archlinux安裝手记(Win10+Arch、GPT+UEFI、lvm)
准备工具和设置制作启动盘连接网络硬盘分区规划分区LVM方案创建文件系统分区挂载激活lvm2钩子基础安装和配置配置镜像源基础系统安装fstab进入系统initramfs引导程序网络搭建使用环境用户管理用 ...
随机推荐
- Android 调试出现 could not get wglGetExtensionsStringARB
解决 AVD Manager -> 选择模拟器 -> 点击 Edit看 Enabled 是不是被选中了.是的话取消选中,OK.希望对你实用.
- 1.3 Quick Start中 Step 2: Start the server官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 2: Start the server Step : 启动服务 Kafka ...
- android 4.4 添加物理按键
kernel下添加 Linux-3.4/drivers/input/keyboard/Makefile linux-3.4/drivers/input/keyboard/sw-keyboard.c s ...
- webpack4 多页面,多环境配置,逐行解释
项目需求制作为新的app的分享页,故需要制作多页面应用,那既然app是新的,这边我们也要更新上,经过多方考察(度娘)下,综合了一些他人的优点并结合项目实况产生了此文. 本文为了解释详细,篇幅可能会较长 ...
- 【hdu 6000】Wash
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 因为每件衣服都是没有区别的. 只有洗衣机不同会影响洗衣时间. 那么我们把每台洗衣机洗衣的时间一开始都加入到队列中. 比如{2,3,6 ...
- amazeui学习笔记--css(布局相关2)--等分网格 AVG Grid
amazeui学习笔记--css(布局相关2)--等分网格 AVG Grid 一.总结 1.与grid区别:网格中:am-g + am-u-xx-n 等分网格中只有一个: am-avg-sm-4(在u ...
- Day2:字典
一.定义 字典是一种“key-value”成对出现的数据类型,中间用冒号把key与value隔,不同的数据用逗号隔开,全部数据用大括号括起来 info = { 'stu1101': "Ten ...
- ThreadPoolExecutor – Java Thread Pool Example(如何使用Executor框架创建一个线程池)
Java thread pool manages the pool of worker threads, it contains a queue that keeps tasks waiting to ...
- python opencv3 —— 常用工具、辅助函数、绘图函数(图像添加文本、矩形等几何形状)
1. cv2.hconcat().cv2.vconcat() 将从摄像头捕获的多个图像帧,横向(cv2.hconcat)或纵向(cv2.vconcat)拼接到一起,使得可以在一个 window 中进行 ...
- 基于深度学习的人脸识别系统(Caffe+OpenCV+Dlib)【二】人脸预处理
前言 基于深度学习的人脸识别系统,一共用到了5个开源库:OpenCV(计算机视觉库).Caffe(深度学习库).Dlib(机器学习库).libfacedetection(人脸检测库).cudnn(gp ...