本文整理汇总了C#中NumericUpDown类的典型用法代码示例。如果您正苦于以下问题:C# NumericUpDown类的具体用法?C# NumericUpDown怎么用?C# NumericUpDown使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NumericUpDown类属于命名空间,在下文中一共展示了NumericUpDown类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNumericUpDown
public static NumericUpDown GetNumericUpDown(int min, int max)
{
NumericUpDown num = new NumericUpDown();
num.Minimum = min;
num.Maximum = max;
return num;
}
示例2: ToolStripNumericUpDownItem
public ToolStripNumericUpDownItem()
: base(new NumericUpDown())
{
numericUpDown = (NumericUpDown)this.Control;
numericUpDown.AutoSize = false;
numericUpDown.Maximum = 1000;
numericUpDown.Size = new Size(30, 20);
}
示例3: TestActualWidthOfNumericUpDownControl
public void TestActualWidthOfNumericUpDownControl()
{
NumericUpDown nud = new NumericUpDown();
nud.Width = 150;
TestAsync(
nud,
() => Assert.AreEqual(nud.ActualWidth, nud.Width));
}
示例4: NumericUpDownAutomationPeerTypeAndClass
public virtual void NumericUpDownAutomationPeerTypeAndClass()
{
NumericUpDown item = new NumericUpDown();
NumericUpDownAutomationPeer peer = null;
TestAsync(
item,
() => peer = FrameworkElementAutomationPeer.CreatePeerForElement(item) as NumericUpDownAutomationPeer,
() => Assert.AreEqual(AutomationControlType.Spinner, peer.GetAutomationControlType(), "Unexpected AutomationControlType!"),
() => Assert.AreEqual("NumericUpDown", peer.GetClassName(), "Unexpected ClassType!"));
}
示例5: NumericUpDownCreatesAutomationPeer
public virtual void NumericUpDownCreatesAutomationPeer()
{
NumericUpDown item = new NumericUpDown();
NumericUpDownAutomationPeer peer = null;
TestAsync(
item,
() => peer = FrameworkElementAutomationPeer.CreatePeerForElement(item) as NumericUpDownAutomationPeer,
() => Assert.IsNotNull(peer, "NumericUpDown peer should not be null!"),
() => Assert.AreEqual(item, peer.Owner, "NumericUpDown should be owner of the peer!"));
}
示例6: NumericUpDownStripItem
public NumericUpDownStripItem(FormForImageDisplay Parent)
: base(new NumericUpDown())
{
this.ThisNumericUpDown = this.Control as NumericUpDown;
this.ThisNumericUpDown.Maximum = 2000;
this.Size = new System.Drawing.Size(83, 20);
this.Parent = Parent;
this.ThisNumericUpDown.ValueChanged += new EventHandler(ThisNumericUpDown_ValueChanged);
}
示例7: mnuChangeDarkness
public mnuChangeDarkness(string name, int price)
: base(name)
{
this.price = price;
this.Size = new Size(250, 250);
this.MenuDirection = Enums.MenuDirection.Vertical;
this.Location = Client.Logic.Graphics.DrawingSupport.GetCenter(Windows.WindowSwitcher.GameWindow.MapViewer.Size, this.Size);
lblAddTile = new Label("lblAddTile");
lblAddTile.Location = new Point(25, 15);
lblAddTile.AutoSize = false;
lblAddTile.Size = new System.Drawing.Size(this.Width - lblAddTile.X * 2, 40);
lblAddTile.Text = "Enter the size of the lights for the house (use -1 for full lighting):";
lblAddTile.ForeColor = Color.WhiteSmoke;
nudAmount = new NumericUpDown("nudAmount");
nudAmount.Size = new Size(120, 24);
nudAmount.Location = new Point(lblAddTile.X, lblAddTile.Y + lblAddTile.Height + 10);
nudAmount.Maximum = 20;
nudAmount.Minimum = -1;
nudAmount.Value = Logic.Maps.MapHelper.ActiveMap.Darkness;
nudAmount.ValueChanged +=new EventHandler<ValueChangedEventArgs>(nudAmount_ValueChanged);
lblPrice = new Label("lblPrice");
lblPrice.Location = new Point(lblAddTile.X, nudAmount.Y + nudAmount.Height + 10);
lblPrice.AutoSize = false;
lblPrice.Size = new System.Drawing.Size(180, 40);
lblPrice.Text = "Adjusting the lighting will cost " + price + " " + Items.ItemHelper.Items[1].Name + ".";
lblPrice.ForeColor = Color.WhiteSmoke;
btnAccept = new Button("btnAccept");
btnAccept.Location = new Point(lblAddTile.X, lblPrice.Y + lblPrice.Height + 10);
btnAccept.Size = new Size(80, 30);
btnAccept.Text = "Set Lights";
btnAccept.Font = FontManager.LoadFont("tahoma", 10);
Skins.SkinManager.LoadButtonGui(btnAccept);
btnAccept.Click += new EventHandler<MouseButtonEventArgs>(btnAccept_Click);
btnCancel = new Button("btnCancel");
btnCancel.Location = new Point(btnAccept.X + btnAccept.Width, lblPrice.Y + lblPrice.Height + 10);
btnCancel.Size = new Size(80, 30);
btnCancel.Text = "Cancel";
btnCancel.Font = FontManager.LoadFont("tahoma", 10);
Skins.SkinManager.LoadButtonGui(btnCancel);
btnCancel.Click += new EventHandler<MouseButtonEventArgs>(btnCancel_Click);
this.AddWidget(lblAddTile);
this.AddWidget(nudAmount);
this.AddWidget(lblPrice);
this.AddWidget(btnAccept);
this.AddWidget(btnCancel);
}
示例8: mnuShopItemSelected
public mnuShopItemSelected(string name, int itemNum, int itemSlot, Enums.InvMenuType transactionType)
: base(name)
{
transaction = transactionType;
base.Size = new Size(185, 125);
base.MenuDirection = Enums.MenuDirection.Horizontal;
if (transaction == Enums.InvMenuType.Buy) {
base.Location = new Point(435, 40);
} else {
base.Location = new Point(335, 40);
}
itemPicker = new Widgets.MenuItemPicker("itemPicker");
itemPicker.Location = new Point(18, 23);
lblMove = new Label("lblMove");
lblMove.Font = FontManager.LoadFont("PMDCP", 32);
lblMove.AutoSize = true;
lblMove.Text = "Store";
lblMove.Location = new Point(30, 8);
lblMove.HoverColor = Color.Red;
lblMove.ForeColor = Color.WhiteSmoke;
lblMove.Click += new EventHandler<SdlDotNet.Widgets.MouseButtonEventArgs>(lblMove_Click);
nudAmount = new NumericUpDown("nudAmount");
nudAmount.Size = new Size(120, 24);
nudAmount.Location = new Point(32, 42);
nudAmount.Font = FontManager.LoadFont("PMDCP", 16);
nudAmount.Minimum = 1;
nudAmount.Maximum = Int32.MaxValue;
lblSummary = new Label("lblSummary");
lblSummary.Font = FontManager.LoadFont("PMDCP", 32);
lblSummary.AutoSize = true;
lblSummary.Text = "Summary";
lblSummary.Location = new Point(30, 58);
lblSummary.HoverColor = Color.Red;
lblSummary.ForeColor = Color.WhiteSmoke;
lblSummary.Click += new EventHandler<SdlDotNet.Widgets.MouseButtonEventArgs>(lblSummary_Click);
this.AddWidget(itemPicker);
this.AddWidget(lblMove);
this.AddWidget(nudAmount);
this.AddWidget(lblSummary);
this.ItemSlot = itemSlot;
this.ItemNum = itemNum;
}
示例9: MainForm
public MainForm ()
{
//
// _numericUpDown
//
_numericUpDown = new NumericUpDown ();
_numericUpDown.Location = new Point (8, 8);
_numericUpDown.Value = 1;
Controls.Add (_numericUpDown);
//
// _tabControl
//
_tabControl = new TabControl ();
_tabControl.Dock = DockStyle.Bottom;
_tabControl.Height = 280;
Controls.Add (_tabControl);
//
// _bugDescriptionText1
//
_bugDescriptionText1 = new TextBox ();
_bugDescriptionText1.Dock = DockStyle.Fill;
_bugDescriptionText1.Multiline = true;
_bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture,
"Steps to execute:{0}{0}" +
"1. Click left of the number inside the NumericUpDown " +
"and do not release the mouse button down.{0}{0}" +
"2. Move to the right of the number.{0}{0}" +
"3. Release the mouse button.{0}{0}" +
"4. Move the mouse pointer left and right over the form.{0}{0}" +
"5. Click to the right of the number.{0}{0}" +
"Expected result:{0}{0}" +
"1. On step 4, the number remains highlighted.{0}{0}" +
"2. On step 5, the number is no longer highlighted.",
Environment.NewLine);
//
// _tabPage1
//
_tabPage1 = new TabPage ();
_tabPage1.Text = "#1";
_tabPage1.Controls.Add (_bugDescriptionText1);
_tabControl.Controls.Add (_tabPage1);
//
// MainForm
//
ClientSize = new Size (500, 320);
StartPosition = FormStartPosition.CenterScreen;
Text = "bug #357482";
}
示例10: Player
public Player(Point pntlocation, double dblBank, NumericUpDown betControl, playerType type, Strategy strategy, CountMethod method)
{
// Since the game is limited to one split (two hands), just set them up now
hands = new Hand[2];
hands[0] = new Hand(new Point(0, 0));
hands[1] = new Hand(new Point(50, 0));
// Player specific variables
location = pntlocation;
bank = dblBank;
plyrStrategy = strategy;
plyrMethod = method;
plyrType = type;
plyrBet = betControl;
// Start out with one hand, they may split pairs to get two
numberOfHands = 1;
}
示例11: UpDownExam
public UpDownExam()
{
numeric = new NumericUpDown();
numeric.Parent = this;
numeric.SetBounds(20, 20, 100, 30);
numeric.Minimum = -1000;
numeric.Maximum = 9000;
numeric.Value = 1000;
numeric.Increment = 1000;
numeric.ThousandsSeparator = true;
numeric.ValueChanged += new EventHandler(numeric_ValueChanged);
domain = new DomainUpDown();
domain.Parent = this;
domain.SetBounds(20, 50, 100, 30);
for (int i = 0; i < str.Length; i++)
{
domain.Items.Add(str[i]);
}
domain.Text = "색상 선택";
domain.SelectedItemChanged += new EventHandler(domain_SelectedItemChanged);
}
示例12: InitializeComponent
private void InitializeComponent() {
this.btnExec = new Button();
this.numUpDown = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.numUpDown)).BeginInit();
this.SuspendLayout();
//
// btnExec
//
this.btnExec.Location = new System.Drawing.Point(142, 6);
this.btnExec.Name = "btnExec";
this.btnExec.Size = new System.Drawing.Size(66, 20);
this.btnExec.TabIndex = 1;
this.btnExec.Text = "Execute";
this.btnExec.UseVisualStyleBackColor = true;
this.btnExec.Click += new System.EventHandler(this.btnExec_Click);
//
// numUpDown
//
this.numUpDown.Location = new System.Drawing.Point(12, 6);
this.numUpDown.Maximum = 2;
this.numUpDown.Minimum = -2;
this.numUpDown.Name = "numUpDown";
this.numUpDown.Size = new System.Drawing.Size(77, 19);
this.numUpDown.TabIndex = 2;
this.numUpDown.Value = 1;
//
// mainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(220, 31);
this.Controls.Add(this.numUpDown);
this.Controls.Add(this.btnExec);
this.Name = "mainForm";
this.Text = "Transpose";
((System.ComponentModel.ISupportInitialize)(this.numUpDown)).EndInit();
this.ResumeLayout(false);
}
示例13: SetPosTest
public SetPosTest ()
{
left_pos = new NumericUpDown ();
top_pos = new NumericUpDown ();
tool_window = new Form ();
tool_window.FormBorderStyle = FormBorderStyle.FixedToolWindow;
tool_window.LocationChanged += new EventHandler (ToolWindowLocationChanged);
Label xlabel = new Label ();
xlabel.Text = "Left:";
Label ylabel = new Label ();
ylabel.Text = "Top:";
xlabel.Width = 45;
ylabel.Width = 45;
xlabel.Left = 10;
left_pos.Left = 55;
ylabel.Left = 10;
top_pos.Left = 55;
ylabel.Top = left_pos.Bottom + 25;
top_pos.Top = left_pos.Bottom + 25;
left_pos.Minimum = top_pos.Minimum = Int32.MinValue;
left_pos.Maximum = top_pos.Maximum = Int32.MaxValue;
left_pos.ValueChanged += new EventHandler (LeftPosChanged);
top_pos.ValueChanged += new EventHandler (TopPosChanged);
Controls.Add (xlabel);
Controls.Add (ylabel);
Controls.Add (left_pos);
Controls.Add (top_pos);
tool_window.Show ();
}
示例14: UpDownBasePeerOnlySupportsValuePattern
public virtual void UpDownBasePeerOnlySupportsValuePattern()
{
NumericUpDown item = new NumericUpDown();
UpDownBaseAutomationPeer<double> peer = null;
TestAsync(
item,
() => peer = new UpDownBaseAutomationPeer<double>(item),
() => Assert.IsNull(peer.GetPattern(PatternInterface.Dock), "UpDownBaseAutomationPeer should not support the Dock pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.ExpandCollapse), "UpDownBaseAutomationPeer should not support the ExpandCollapse pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.Grid), "UpDownBaseAutomationPeer should not support the Grid pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.GridItem), "UpDownBaseAutomationPeer should not support the GridItem pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.Invoke), "UpDownBaseAutomationPeer should not support the Dock pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.MultipleView), "UpDownBaseAutomationPeer should not support the MultipleView pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.RangeValue), "UpDownBaseAutomationPeer should not support the RangeValue pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.Scroll), "UpDownBaseAutomationPeer should not support the Scroll pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.ScrollItem), "UpDownBaseAutomationPeer should not support the ScrollItem pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.Selection), "UpDownBaseAutomationPeer should not support the Selection pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.Table), "UpDownBaseAutomationPeer should not support the Table pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.TableItem), "UpDownBaseAutomationPeer should not support the TableItem pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.Toggle), "UpDownBaseAutomationPeer should not support the Toggle pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.Transform), "UpDownBaseAutomationPeer should not support the Transform pattern!"),
() => Assert.IsNotNull(peer.GetPattern(PatternInterface.Value), "UpDownBaseAutomationPeer should support the Value pattern!"),
() => Assert.IsNull(peer.GetPattern(PatternInterface.Window), "UpDownBaseAutomationPeer should not support the Window pattern!"));
}
示例15: mnuItemSelected
public mnuItemSelected(string name, int itemSlot)
: base(name)
{
if ((int)Items.ItemHelper.Items[Players.PlayerManager.MyPlayer.GetInvItemNum(itemSlot)].Type < 8 || (int)Items.ItemHelper.Items[Players.PlayerManager.MyPlayer.GetInvItemNum(itemSlot)].Type == 15) {
//cannot use item
base.Size = new Size(165, 165);
maxItems = 3;
useable = false;
} else {
//can use item
base.Size = new Size(165, 195);
maxItems = 4;
useable = true;
}
base.MenuDirection = Enums.MenuDirection.Horizontal;
base.Location = new Point(335, 40);
itemPicker = new Widgets.MenuItemPicker("itemPicker");
itemPicker.Location = new Point(18, 23);
int widgetY = 8;
//add choices
lblHold = new Label("lblHold");
lblHold.Size = new System.Drawing.Size(120, 32);
lblHold.Font = FontManager.LoadFont("PMU", 32);
//lblHold.AutoSize = true;
lblHold.Text = "Hold";
lblHold.Location = new Point(30, widgetY);
lblHold.HoverColor = Color.Red;
lblHold.Click += new EventHandler<SdlDotNet.Widgets.MouseButtonEventArgs>(lblHold_Click);
lblHold.ForeColor = Color.WhiteSmoke;
this.AddWidget(lblHold);
widgetY += 30;
if (useable) {
lblUse = new Label("lblUse");
lblUse.Font = FontManager.LoadFont("PMU", 32);
lblUse.AutoSize = true;
lblUse.Text = "Use";
lblUse.Location = new Point(30, widgetY);
lblUse.HoverColor = Color.Red;
lblUse.ForeColor = Color.WhiteSmoke;
lblUse.Click += new EventHandler<SdlDotNet.Widgets.MouseButtonEventArgs>(lblUse_Click);
this.AddWidget(lblUse);
widgetY += 30;
}
lblThrow = new Label("lblThrow");
lblThrow.Size = new System.Drawing.Size(120, 32);
lblThrow.Location = new Point(30, widgetY);
lblThrow.Font = FontManager.LoadFont("PMU", 32);
lblThrow.Text = "Throw";
lblThrow.HoverColor = Color.Red;
lblThrow.ForeColor = Color.WhiteSmoke;
lblThrow.Click += new EventHandler<SdlDotNet.Widgets.MouseButtonEventArgs>(lblThrow_Click);
widgetY += 30;
lblSummary = new Label("lblSummary");
lblSummary.Size = new System.Drawing.Size(120, 32);
lblSummary.Location = new Point(30, widgetY);
lblSummary.Font = FontManager.LoadFont("PMU", 32);
lblSummary.Text = "Summary";
lblSummary.HoverColor = Color.Red;
lblSummary.ForeColor = Color.WhiteSmoke;
lblSummary.Click += new EventHandler<SdlDotNet.Widgets.MouseButtonEventArgs>(lblSummary_Click);
widgetY += 30;
lblDrop = new Label("lblDrop");
lblDrop.Font = FontManager.LoadFont("PMU", 32);
lblDrop.Size = new System.Drawing.Size(130, 32);
lblDrop.AutoSize = false;
//lblDrop.Text = "Drop";
lblDrop.Location = new Point(30, widgetY);
lblDrop.HoverColor = Color.Red;
lblDrop.ForeColor = Color.WhiteSmoke;
lblDrop.Click += new EventHandler<SdlDotNet.Widgets.MouseButtonEventArgs>(lblDrop_Click);
widgetY += 32;
if (Items.ItemHelper.Items[Players.PlayerManager.MyPlayer.GetInvItemNum(itemSlot)].Type == Enums.ItemType.Currency || Items.ItemHelper.Items[Players.PlayerManager.MyPlayer.GetInvItemNum(itemSlot)].StackCap > 0) {
lblDrop.Text = "Drop Amount:";
nudAmount = new NumericUpDown("nudAmount");
nudAmount.Size = new Size(120, 24);
nudAmount.Location = new Point(32, widgetY);
nudAmount.Maximum = Players.PlayerManager.MyPlayer.Inventory[itemSlot].Value;
nudAmount.Minimum = 1;
this.AddWidget(nudAmount);
} else {
lblDrop.Text = "Drop";
}
this.AddWidget(lblDrop);
this.AddWidget(lblSummary);
this.AddWidget(lblThrow);
//.........这里部分代码省略.........