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中的 ...
随机推荐
- 将网页发布到远程windows server
1.在vs下利用文件系统发布asp.net文件 2.将生成的所有文件打包成ZIP 3.将zip文件复制并解压到远程windows server的自己创建的文件夹下 4.在windows server上 ...
- Enabling Remote Errors in SSRS
January 18, 2011 By default the remote errors property in SQL Server Reporting Services is set to fa ...
- org.springframework.dao.CannotAcquireLockException解决
java.sql.SQLException: Lock wait timeout exceeded 该异常为一个service中调用了另一个service,两个service对同一表进行操作,造成事务 ...
- python 单线程实现并发
单线程下支持并发(服务端): from gevent import spawn,monkey;monkey.patch_all() from socket import * def server(ip ...
- [bzoj3995] [SDOI2015]道路修建 线段树
Description 某国有2N个城市,这2N个城市构成了一个2行N列的方格网.现在该国政府有一个旅游发展计划,这个计划需要选定L.R两列(L<=R),修建若干条专用道路,使得这两列之间(包括 ...
- django基础2
一. 使用原生sql,了解即可 使用原生sql的目的:解决一些复杂的sql不能用ORM方式写出的问题 有三种方式如下 1. extra: 结果集修改器,一种提供额外查询参数的机制 2. raw:执行原 ...
- Google 推出新搜索引擎以查找数据集
简评:谷歌推出了一个用于寻找数据集的新搜索引擎,有点厉害! 该工具可以更轻松地访问 Web 上数千个数据存储库中的数百万个数据集,当前还处于测试版: 什么是 Dataset Search? 数 ...
- 2016级算法期末上机-F.中等·AlvinZH's Fight with DDLs II
1118 AlvinZH's Fight with DDLs II 思路 中等题,贪心. 理解题意,每次攻击中,可以使某个敌人生命值-1,自己生命值减去∑存活敌人总攻击力. 贪心思想,血量少攻击高的要 ...
- 【SpringBoot+Mybatis+thymeleaf报错】Error resolving template "XXX", template might not exist or might not be accessible by any of the configured
解决方法一: 原因:在使用springboot的过程中,如果使用thymeleaf作为模板文件,则要求HTML格式必须为严格的html5格式,必须有结束标签,否则会报错. 在application.y ...
- win7 wifi sharing
1.启用并设定虚拟WiFi网卡: netsh wlan set hostednetwork mode=allow ssid=mywifi key=12345678 此命令有三个参数,mode:是否启用 ...