当前位置: 首页>>代码示例>>C#>>正文


C# NumericUpDown.Select方法代码示例

本文整理汇总了C#中System.Windows.Forms.NumericUpDown.Select方法的典型用法代码示例。如果您正苦于以下问题:C# NumericUpDown.Select方法的具体用法?C# NumericUpDown.Select怎么用?C# NumericUpDown.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.NumericUpDown的用法示例。


在下文中一共展示了NumericUpDown.Select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowNumericDialog

        public static int ShowNumericDialog(string text, string caption)
        {
            var prompt = new Form()
            {
                FormBorderStyle = FormBorderStyle.FixedDialog,
                MinimizeBox = false,
                MaximizeBox = false,
                Width = 160,
                Height = 130,
                Text = caption,
                StartPosition = FormStartPosition.CenterScreen,
            };

            var cancel = new Button();
            cancel.Click += (sender, e) => prompt.Close();
            prompt.CancelButton = cancel;

            var textLabel = new Label()
            {
                Top = 10,
                Text = text,
                TextAlign = ContentAlignment.MiddleCenter,
                AutoSize = false,
                Width = prompt.Width
            };

            var textBox = new NumericUpDown() { Left = 20, Top = 40, Width = 120, Height = 80, Text = "5" };
            var confirmation = new Button() { Text = "Ok", Left = 30, Top = 70, Width = 100, DialogResult = DialogResult.OK };
            confirmation.Click += (sender, e) => { prompt.Close(); };

            prompt.Controls.Add(textBox);
            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(textLabel);
            prompt.AcceptButton = confirmation;

            textBox.Select(0, textBox.Text.Length);

            if (prompt.ShowDialog() == DialogResult.OK)
            {
                int inputValue;
                if (int.TryParse(textBox.Text, out inputValue))
                {
                    return inputValue;
                }
            }
            return -1;
        }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:47,代码来源:DrawingsLabDialogs.cs

示例2: OnInvalidControl

    OnInvalidNumericUpDown
    (
        NumericUpDown oNumericUpDown,
        String sErrorMessage
    )
    {
        Debug.Assert(oNumericUpDown != null);
        Debug.Assert(sErrorMessage != null && sErrorMessage != "");

        OnInvalidControl(oNumericUpDown, sErrorMessage);
        oNumericUpDown.Select(0, oNumericUpDown.Text.Length);

        return (false);
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:14,代码来源:FormPlus.cs

示例3: SelectValueOnFocus

 private static void SelectValueOnFocus(NumericUpDown control)
 {
     control.Select(0, control.Text.Length);
 }
开发者ID:jgera,项目名称:FerretLib.WinForms,代码行数:4,代码来源:ColorPicker.cs

示例4: prepareSeasonNrControl

 private void prepareSeasonNrControl(MediaFile someCandidate, NumericUpDown seasonNrControl)
 {
     // FIXME: Can't you set this just once?
     seasonNrControl.Minimum = 1;
     TvShow titleCollection = TvShowManager.Instance.GetTvShow(someCandidate.Showname);
     if (titleCollection != null) {
         seasonNrControl.Maximum = titleCollection.FindMaxSeason();
     }
     seasonNrControl.Select(0, seasonNrControl.Text.Length);
 }
开发者ID:danowar2k,项目名称:seriesrenamer,代码行数:10,代码来源:MainForm.cs

示例5: ShowInlineFormLeaveList

        private void ShowInlineFormLeaveList()
        {
            this.FormEditItem();
            CustomTimePicker inline_from_time = new CustomTimePicker();
            inline_from_time.Name = "inline_from_time";
            inline_from_time.Read_Only = false;
            this.dgvLeaveList.Parent.Controls.Add(inline_from_time);

            CustomTimePicker inline_to_time = new CustomTimePicker();
            inline_to_time.Name = "inline_to_time";
            inline_to_time.Read_Only = false;
            this.dgvLeaveList.Parent.Controls.Add(inline_to_time);

            CustomComboBox inline_status = new CustomComboBox();
            inline_status.Name = "inline_status";
            inline_status.Read_Only = false;
            inline_status.BorderStyle = BorderStyle.None;
            inline_status.AddItem(new ComboboxItem("WAIT", (int)CustomDateEvent.EVENT_STATUS.WAIT_FOR_CONFIRM, "WAIT"));
            inline_status.AddItem(new ComboboxItem("CONFIRMED", (int)CustomDateEvent.EVENT_STATUS.CONFIRMED, "CONFIRMED"));
            inline_status.AddItem(new ComboboxItem("CANCELED", (int)CustomDateEvent.EVENT_STATUS.CANCELED, "CANCELED"));
            this.dgvLeaveList.Parent.Controls.Add(inline_status);

            CustomTextBox inline_customer = new CustomTextBox();
            inline_customer.Name = "inline_customer";
            inline_customer.Read_Only = false;
            inline_customer.BorderStyle = BorderStyle.None;
            inline_customer.MaxChar = 40;
            this.dgvLeaveList.Parent.Controls.Add(inline_customer);

            CustomComboBox inline_medcert = new CustomComboBox();
            inline_medcert.Name = "inline_medcert";
            inline_medcert.Read_Only = false;
            inline_medcert.BorderStyle = BorderStyle.None;
            inline_medcert.AddItem(new ComboboxItem("N/A (ไม่ระบุ)", 9, "X"));
            inline_medcert.AddItem(new ComboboxItem("ไม่มีใบรับรองแพทย์", 0, "N"));
            inline_medcert.AddItem(new ComboboxItem("มีใบรับรองแพทย์", 1, "Y"));
            this.dgvLeaveList.Parent.Controls.Add(inline_medcert);

            NumericUpDown inline_fine = new NumericUpDown();
            inline_fine.Name = "inline_fine";
            inline_fine.Font = new Font("tahoma", 9.75f);
            inline_fine.Maximum = 1000;
            inline_fine.Minimum = 0;
            inline_fine.BorderStyle = BorderStyle.None;
            inline_fine.TextAlign = HorizontalAlignment.Right;
            inline_fine.GotFocus += delegate
            {
                inline_fine.Select(0, inline_fine.Text.Length);
            };
            this.dgvLeaveList.Parent.Controls.Add(inline_fine);

            this.SetPositionFormLeaveList();
            this.dgvAbsentSummary.Enabled = false;
            this.dgvLeaveList.Enabled = false;
            this.dgvLeaveList.SendToBack();
            inline_from_time.BringToFront();
            inline_to_time.BringToFront();
            inline_status.BringToFront();
            inline_customer.BringToFront();
            inline_medcert.BringToFront();
            inline_fine.BringToFront();

            if (this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag is EventCalendar)
            {
                string[] from = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).from_time.Split(':');
                inline_from_time.Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), 0);
                string[] to = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).to_time.Split(':');
                inline_to_time.Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), 0);
                inline_status.comboBox1.SelectedItem = inline_status.comboBox1.Items.Cast<ComboboxItem>().Where(i => i.int_value == ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).status).First<ComboboxItem>();
                inline_customer.Texts = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).customer;
                inline_medcert.comboBox1.SelectedItem = inline_medcert.comboBox1.Items.Cast<ComboboxItem>().Where(i => i.string_value == ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).med_cert).First<ComboboxItem>();
                inline_fine.Value = ((EventCalendar)this.dgvLeaveList.Rows[this.dgvLeaveList.CurrentCell.RowIndex].Tag).fine;
            }
        }
开发者ID:wee2tee,项目名称:SN_Net,代码行数:74,代码来源:LeaveWindow.cs


注:本文中的System.Windows.Forms.NumericUpDown.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。