让我们说我们已经0显示在控件的值字段中,我希望如果值是0- 显示string.Empty(我知道值的类型是十进制,并且不能插入字符串而不是小数,但仍然...也许那里有一些格式化吗?).
我在C#中有一个带有NumericUpDown控件的WinForm.我希望Control仅在单击其向上或向下箭头后更改其值,并阻止手动文本条目,是否有NumericUpDown的属性来执行此操作,还是以任何其他方式实现?
我有一个WPF窗口,其中包含一堆数字.或者使用更好的单词:每列绑定到一个int属性.现在我希望有一个很好的方法来改变一些数字,我希望我可以使用numericUpDown控件.任何提示将不胜感激!
如何设置 NumericUpDown 控件以将值显示为百分比?
我们在应用程序中使用Telerik RadNumericUpDown控件(2013版)来显示和编辑double值和整数; 该控件适用于可以为空的double类型:它不显示空值,0.00显示0值.我们希望整数具有相同的行为,但控件始终显示0表示空值.我已经尝试将NullValue设置为空字符串&null,基于此处的讨论:http://www.telerik.com/community/forums/silverlight/numericupdown/null.aspx,但这不能解决我们的问题.
XAML:
<telerik:RadNumericUpDown Value="{Binding Path=Contents, Mode=TwoWay}"
NumberDecimalDigits="0"
IsEnabled="True"
IsEditable="True"
IsInteger="True"
NullValue=""
MinWidth="70"
HorizontalAlignment="Left"
HorizontalContentAlignment="Left" />
Run Code Online (Sandbox Code Playgroud)
Contents属性是一个可以为null的int.
任何帮助表示赞赏.
大家好日子,我在将一个数字小写值传递给一个整数时遇到了问题.
private void button5_Click(object sender, EventArgs e)
{
int count = numericUpDown1.Value;
updateCount(count);
}
Run Code Online (Sandbox Code Playgroud)
所以,我想要这样做,所以将numericupdown值的值传递给整数命名count,然后将值传递给更新数据库中的表的方法.
我刚开始使用c#,似乎无法理解一些文档.
感谢你们!
我有这样的数据绑定:
numericUpDown1.DataBindings.Add("Value", myBox1, "Width");
Run Code Online (Sandbox Code Playgroud)
每当myBox1.Width更改时,它将更新numericUpDown1.Value.
问题是当在控件上输入新数字时,myBox1.Width不会立即更新,而是仅在光标离开控件的文本区域之后.这个bug有什么解决方法吗?谢谢!
我有简单的Windows窗体应用程序(不是WPF),我有两个控件:
我想在它们之间进行一些绑定,因此如果其中一个值的值发生变化,则另一个控件将更新以显示相同的值.
这可能吗?如果是这样,我该怎么办?
谢谢.
我有一个带有System.Windows.Forms.NumericUpDown控件的表单.
假设范围是从0到100,并且当前值(通过微调器到达)是100.我可以输入一个超出允许范围的数字(比如567),但是当我在表单上单击"确定"时重置该值,它只是静默地将超出范围值设置为100并关闭表单.
客户想要一个明确的消息,即该号码超出范围.所以,我看着NumericUpDown.Text关闭窗体检查属性,但该属性给了我"100"而不是"567".
在哪里(或如何)可以"捕获"控件中出现的文字是"567"的事实?
我对 C# 很陌生,有一个问题。我已经能够通过将 FlatStyle 更改为“Flat”来更改按钮的边框颜色等。使用NumericUpDown,我无法更改 FlatStyle。我希望仍然能够使用向上和向下箭头,因此仅使用其他东西来覆盖边缘是行不通的。这是我在代码中所做的事情的简化版本:
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace bordertest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
BackColor = Color.Black;
numericUpDown1.BackColor = Color.Red;
}
}
}
Run Code Online (Sandbox Code Playgroud) numericupdown ×10
c# ×7
winforms ×6
.net ×4
controls ×2
wpf ×2
.net-2.0 ×1
data-binding ×1
datagrid ×1
integer ×1
telerik ×1
trackbar ×1
validation ×1
vb.net ×1