NUmericupdown控件
Numericupdown控件是由system.windows.froms.Numericupdown类提供的,主要作用是将一个数按一定的值进行增加或减少。它主要有四个常用属性
Increment 每次单击按钮时增加或者减少的量
Maximum 最大值
Minimum 最小值
Value 当前值
decimalPlaces 显示小数的位数

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 Numericupdown
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
label3.Text = "设置值的增量";
button1.Text = "增加";
button2.Text = "减少";
label1.Text = "0";
numericUpDown1.Maximum = 10000;
} private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
label1.Text = numericUpDown1.Value.ToString();
} private void button1_Click(object sender, EventArgs e)
{
numericUpDown1.UpButton();
} private void button2_Click(object sender, EventArgs e)
{
numericUpDown1.DownButton();
} private void textBox2_TextChanged(object sender, EventArgs e)
{
try
{
numericUpDown1.Increment = int.Parse(textBox2.Text);
}
catch
{
MessageBox.Show("格式错误");
} } private void textBox1_TextChanged(object sender, EventArgs e)
{
try
{
numericUpDown1.DecimalPlaces = int.Parse(textBox1.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message); } }
}
}
NUmericupdown控件的更多相关文章
- VB 中 NumericUpDown 控件 如何为手动输入设定触发事件
Private Sub numDuration_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) ...
- C# System.Windows.Forms.NumericUpDown 控件全选其中文字
num_length.Focus(); UpDownBase updbText = (UpDownBase)num_length; ...
- C#常用控件介绍
目录 1.窗体(Form) 2.Label (标签)控件 3.TextBox(文本框)控件 4.RichTe ...
- .NET组件控件实例编程系列——5.DataGridView数值列和日期列
在使用DataGridView编辑数据的时候,编辑的单元格一般会显示为文本框,逻辑值和图片会自动显示对应类型的列.当然我们自己可以手工选择列的类型,例如ComboBox列.Button列.Link列. ...
- winFrom 常用控件属性及方法介绍
目录 1.窗体(Form) 2.Label (标签)控件 3.TextBox(文本框)控件 4.RichTextBox控件 5.NumericUpDown控件 6.Button(按钮)控件 7.Gro ...
- C#控件及常用设计整
C#控件及常用设计整 1.窗体 1 2.Label 控件 3 3.TextBox 控件 4 4.RichTextBox控件 5 5.NumericUpDown 控件 7 ...
- Winform 控件
※控件在视图工具箱里面找,找到之后双击即可添加进来,也可以点住拖进来 ※每个工具,控件,窗体都有一个name,相当于id,用来标识该对象的名称,name值不允许重复 控件: 1.Label -- 文本 ...
- C#打印页面的纸张设置问题Spread表格控件
这段时间学习spread控件,用到打印设置上边,其他的设置都还好说,但是打印纸张的大小,纸张类型等把我折腾的够呛,找了半天才找到,记录下来备查. 1.打印纸张类型: System.Drawing.Pr ...
- [WinForm] 使用反射将业务对象绑定到窗体或控件容器
在WebForm中,可以使用反射将业务对象绑定到 ASP.NET 窗体控件.最近做Winform项目,也参考WebForm中的代码实现同样的功能. Winform没有提供类似WebForm中的 ...
随机推荐
- form 认证 读取
class Program { public static CookieContainer cc { get; set; } static void Main(string[] args) { str ...
- “java.lang.NullPointerException”异常分析
1.父类定义的某个属性,没有被子类使用,或者在子类中,又重新定义一次. 2.因为调用了一个object的方法,且此object的reference为null:比如说:String a=null; // ...
- java使用Redis1--安装与简单使用
环境: CentOS6.4,Redis3.0.3 一.Redis安装(需要安装gcc) 官网http://download.redis.io/releases/redis-3.0.3.tar.gz上下 ...
- iOS --UIScrollView的学习(一)
1.为什么使用UIScrollView 因为移动设备的屏幕大小是极其有限的,因此直接展示在用户眼前的内容也相当有限,当展示的内容较多,超出一个屏幕时,用户可通过滚动手势来查看屏幕以外的内容普通的UIV ...
- iOS开发中断言的使用—NSAssert()
原文链接:http://blog.csdn.net/univcore/article/details/16859263 断言(assertion)是指在开发期间使用的.让程序在运行时进行自检的代码(通 ...
- Vue 父子组件传递方式
问题: parent.vue <template> <div> 父组件 <child :childObject="asyncObject">&l ...
- QuantLib 金融计算——基本组件之 DayCounter 类
目录 QuantLib 金融计算--基本组件之 DayCounter 类 DayCounter 对象的构造 一些常用的成员函数 如果未做特别说明,文中的程序都是 Python3 代码. QuantLi ...
- 何在不联网的情况下ping通主机与虚拟机
选择NAT模式,VM对windows选择ping操作时选择VMnet8的IP地址.
- (转) Linux 内核运行参数修改——sysctl命令
原文:https://blog.csdn.net/u012707739/article/details/78254241 sysctl命令被用于在内核运行时动态地修改内核的运行参数,可用的内核参数在目 ...
- javascript中childNodes与children的区别
1.childNodes:获取节点,不同浏览器表现不同: IE:只获取元素节点: 非IE:获取元素节点与文本节点: 解决方案:if(childNode.nodeName=="#text&qu ...