我想接受数字和小数点,但没有迹象.
我已经使用Windows窗体的NumericUpDown控件和Microsoft的NumericUpDown自定义控件示例查看了示例.但到目前为止,似乎NumericUpDown(WPF支持或不支持)不会提供我想要的功能.我的应用程序的设计方式,没有人在他们正确的头脑中想要弄乱箭头.在我的申请中,它们没有任何实际意义.
所以我正在寻找一种简单的方法来使标准的WPF TextBox只接受我想要的字符.这可能吗?这是实用的吗?
进入第一个严肃的WPF项目.似乎缺少很多基本控件.具体来说,我正在寻找Numeric UpDown控件.有没有我错过的带外发布?真的不想写我自己的控件.
我不想使用WindowsFormHost并在其上安装WinForm ctl.我希望它完全没有任何遗留垃圾的WPF.
谢谢
我在WPF中寻找一个简单的NumericUpDown(又名数字微调器)控件.这似乎是WPF中另一个缺乏控制的.必须有一些现有的,我不喜欢重新发明轮子.
当用户NumericUpDown选中我的时候,我希望选择所有文本.这可能吗?
我试图在Android中找到NumericUpDown按钮,但失败了.你知道在Android中调用控制器的内容 - 请告诉我!
<?xml version="1.0" encoding="utf-8"?>
<!--
main.xml
7/22 2010
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<GridView
android:id="@+id/GridView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="3"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:columnWidth="90dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:background="@color/white"
>
</GridView>
<ButtonUpDown>
<!-- The real name is??? -->
</ButtonUpDown>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
Thanx为您的时间 编辑:
在WinForms中是否可以在NumericUpDown控件中显示文本?例如,我想显示我的numericupdown控件中的值是微安培,所以它应该像"1 uA".
谢谢.
有没有办法使用DecimalFormat(或其他一些标准格式化程序)来格式化这样的数字:
1,000,000 => 1.00M
1,234,567 => 1.23M
1,234,567,890 => 1234.57M
基本上将一些数字除以1百万,保留2位小数,并在末尾打一个"M".我已经考虑过创建一个新的NumberFormat子类,但它看起来比我想象的要复杂.
我正在编写一个API,其格式方法如下所示:
public String format(double value, Unit unit); // Unit is an enum
Run Code Online (Sandbox Code Playgroud)
在内部,我将Unit对象映射到NumberFormatters.实现是这样的:
public String format(double value, Unit unit)
{
NumberFormatter formatter = formatters.get(unit);
return formatter.format(value);
}
Run Code Online (Sandbox Code Playgroud)
请注意,因为这个,我不能指望客户端除以100万,我不能只使用String.format()而不将它包装在NumberFormatter中.
在vba中是否有内置的数值更新控件,还是我们需要创建这样的控件?
如果有这样的控制,那么我们可以使用什么事件.
请建议.
我试图覆盖鼠标滚轮控件,这样当鼠标滚轮向上或向下移动时,它只会将numericupdown字段中的值增加1.我相信它当前正在使用存储在控制面板中的内容并增加/减少每次值3.
我正在使用以下代码.即使numberOfTextLinesToMove只有1,我看到txtPrice.Value按预期填充,其他东西会覆盖它,因为我设置的值不是numericupdown框中显示的值
void txtPrice_MouseWheel(object sender, MouseEventArgs e)
{
int numberOfTextLinesToMove = e.Delta / 120;
if (numberOfTextLinesToMove > 0)
{
txtPrice.Value = txtPrice.Value + (txtPrice.Increment * numberOfTextLinesToMove);
}
else
{
txtPrice.Value = txtPrice.Value - (txtPrice.Increment * numberOfTextLinesToMove);
}
}
Run Code Online (Sandbox Code Playgroud) 我使用的是Microsoft Visual C#2010 Express.当我使用箭头更改numericUpDown的值时,我的按钮变为启用.但是当我通过直接更改文本来更改numericUpDown的值时,我也想启用我的按钮.
我使用以下代码:
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
button1.Enabled = true;
}
Run Code Online (Sandbox Code Playgroud)