當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。