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


C# TextBox.ResetText方法代码示例

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


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

示例1: DisplayRegion

 /*************
 * AUX METHODS*
 **************/
 private void DisplayRegion(char[,] map, TextBox display)
 {
     display.ResetText();
       for (int r = 0; r <= 14; r++)
       {
     for (int c = 0; c <= 14; c++)
     {
       if (map[r, c] == '#')
     area++;
       display.Text += map[r, c].ToString();
     }
     display.AppendText("\n");
       }
 }
开发者ID:JDavis22,项目名称:CIS350,代码行数:17,代码来源:Form.cs

示例2: _CreateRowView


//.........这里部分代码省略.........
                        AutoSize = true,
                        Dock = DockStyle.Fill,
                        MultiColumn = false,
                        Name = dc.ColumnName
                    };

                    checkedListBox.ItemCheck += _RowView_CheckedListBox_ItemCheck;
                    _specialControls.Add(dc.ColumnName, checkedListBox);

                    OutputAttribute attribute = ExcelFile.GetExcelAttribute(_dataFile.DataType.GetField(dc.ColumnName));

                    // Populate the checklist by either a enum or (less commonly) table indices
                    if (!String.IsNullOrEmpty(attribute.TableStringId))
                    {
                        // TODO: should perhaps use object delegator here, it might be faster
                        // so far its only its runtime is only 1n so doesnt really matter.
                        //
                        DataTable dataTable = _fileManager.GetDataTable(attribute.TableStringId);
                        foreach (DataRow row in dataTable.Rows)
                        {
                            checkedListBox.Items.Add(row[2], false);
                        }
                    }
                    else
                    {
                        Type cellType = dc.DataType;
                        foreach (Enum type in Enum.GetValues(cellType))
                        {
                            checkedListBox.Items.Add(type, false);
                        }
                    }
                }
                else if (dc.ExtendedProperties.ContainsKey(ExcelFile.ColumnTypeKeys.IsEnum) && (bool)dc.ExtendedProperties[ExcelFile.ColumnTypeKeys.IsEnum])
                {
                    ComboBox comboBox = new ComboBox
                    {
                        Parent = _rows_LayoutPanel,
                        Dock = DockStyle.Fill,
                        Name = dc.ColumnName
                    };

                    // todo: consider lookomg into overloaded FindString or FindExactString methods and check (change) the startIndex parameter
                    Binding comboBoxBinding = comboBox.DataBindings.Add("SelectedIndex", _dataTable, dc.ColumnName, true);
                    comboBoxBinding.Format += _ComboBoxFormat;
                    comboBox.SelectedIndexChanged += _RowView_ComboList_ItemChange;

                    // need order as VALUE order - Enum.GetValues provides sorted as UNSIGNED values e.g. {0, 1, 2, 3, -3, -2, -1} instead of {-3, -2, -1, 0, 1, 2, 3}
                    List<Enum> enumValues = Enum.GetValues(dc.DataType).Cast<Enum>().ToList();
                    enumValues.Sort(); // List sort works as SIGNED
                    comboBox.Items.AddRange(enumValues.ToArray());
                    comboBox.Tag = Math.Abs(Convert.ToInt32(enumValues.Min())); // we need a minimum value to get our base offset
                }
                else
                {
                    TextBox textBox = new TextBox
                    {
                        Text = String.Empty,
                        Parent = _rows_LayoutPanel,
                        AutoSize = true,
                        Dock = DockStyle.Fill,
                        Name = dc.ColumnName
                    };
                    textBox.DataBindings.Add("Text", _dataTable, dc.ColumnName);

                    if ((dc.ExtendedProperties.ContainsKey(ExcelFile.ColumnTypeKeys.IsRelationGenerated) && (bool)dc.ExtendedProperties[ExcelFile.ColumnTypeKeys.IsRelationGenerated]) || column == 0)
                    {
                        textBox.ReadOnly = true;
                        if (relationTextBox != null)
                        {
                            relationTextBox.TextChanged += (sender, e) => textBox.ResetText();
                        }
                    }

                    if ((dc.ExtendedProperties.ContainsKey(ExcelFile.ColumnTypeKeys.IsStringIndex) && (bool)dc.ExtendedProperties[ExcelFile.ColumnTypeKeys.IsStringIndex]) ||
                        (dc.ExtendedProperties.ContainsKey(ExcelFile.ColumnTypeKeys.IsStringOffset) && (bool)dc.ExtendedProperties[ExcelFile.ColumnTypeKeys.IsStringOffset]))
                    {
                        relationTextBox = textBox;
                    }
                    else
                    {
                        relationTextBox = null;
                    }
                }
            }

            new Label
            {
                Text = String.Empty,
                Parent = _rows_LayoutPanel,
                AutoSize = true,
                Dock = DockStyle.Fill
            };
            _rows_LayoutPanel.ResumeLayout();
            _rows_LayoutPanel.Width += 10;

            // fixes mouse scroll wheel
            // todo: this is dodgy and causes focused elements within the layoutpanel to lose focus (e.g. a text box) - rather anoying
            _rows_LayoutPanel.Click += (sender, e) => _rows_LayoutPanel.Focus();
            _rows_LayoutPanel.MouseEnter += (sender, e) => _rows_LayoutPanel.Focus();
        }
开发者ID:khadoran,项目名称:reanimator,代码行数:101,代码来源:DatafileEditor.cs

示例3: SetAllMentionToTextBox

        public static void SetAllMentionToTextBox(TextBox tb, ListViewItem item, ref TwitterModelClass tmc)
        {
            TwitterStatus status = (TwitterStatus)item.Tag;
            tb.Tag = item;
            tb.ResetText();

            List<string> screenNameList = new List<string>();
            screenNameList.Add(status.User.ScreenName);

            foreach (TwitterMention tm in status.Entities.Mentions)
            {
                screenNameList.Add(tm.ScreenName);
            }

            string MySName = tmc.MySName;
            screenNameList.RemoveAll((s => s == MySName));

            foreach (string sname in screenNameList)
            {
                tb.Text = tb.Text + "@" + sname + " ";
            }
            tb.Focus();
            tb.Select(tb.TextLength, 0);
        }
开发者ID:keno0923,项目名称:Trc2,代码行数:24,代码来源:TwitterViewClass.cs


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