本文整理汇总了C#中System.Windows.Forms.ToolStripTextBox.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripTextBox.Clear方法的具体用法?C# ToolStripTextBox.Clear怎么用?C# ToolStripTextBox.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripTextBox
的用法示例。
在下文中一共展示了ToolStripTextBox.Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _Setup
/// <summary>
/// Sets up a drop-down menu to allow file-system selection.
/// </summary>
private void _Setup(string Path, ToolStripMenuItem Item, _Mode Mode, Action<string> OnSelect)
{
if (Mode == _Mode.Save)
{
ToolStripTextBox textbox = new ToolStripTextBox();
Item.DropDownItems.Add(textbox);
textbox.ToolTipText = "Type a file name here. Press Enter to save, or Control + Enter to make a new folder.";
textbox.KeyDown += delegate(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (e.Control)
{
string dirname = textbox.Text;
string dirpath = Path + System.IO.Path.DirectorySeparatorChar + dirname;
Directory.CreateDirectory(dirpath);
ToolStripMenuItem item = new ToolStripMenuItem(dirname);
this._Setup(dirpath, item, _Mode.Save, OnSelect);
Item.DropDownItems.Insert(1, item);
textbox.Clear();
}
else
{
this.HideDropDown();
OnSelect(Path + System.IO.Path.DirectorySeparatorChar + textbox.Text + this.Extension);
}
}
};
Item.DropDownOpening += delegate
{
this._Populate(Path, Item, Mode, OnSelect);
};
Item.DropDownClosed += delegate
{
textbox.Clear();
Item.DropDownItems.Clear();
Item.DropDownItems.Add(textbox);
};
}
else
{
ToolStripMenuItem dummy = new ToolStripMenuItem("(Nothing Here)");
dummy.Enabled = false;
Item.DropDownItems.Add(dummy);
Item.DropDownOpening += delegate
{
if (this._Populate(Path, Item, Mode, OnSelect))
{
Item.DropDownItems.Remove(dummy);
}
};
Item.DropDownClosed += delegate
{
Item.DropDownItems.Clear();
Item.DropDownItems.Add(dummy);
};
}
}
示例2: Main
//.........这里部分代码省略.........
rebootonfail.Image = ServerManager.Properties.Resources.restart;
rebootonfail.Checked = Program.Config.Values.Connection.AutoRestart;
rebootonfail.CheckOnClick = true;
rebootonfail.Click += (ob, ev) =>
{
Program.Config.Values.Connection.AutoRestart = rebootonfail.Checked;
};
options.Text = "Options";
options.BackColor = c;
options.Image = ServerManager.Properties.Resources.settings;
options.DropDown.Items.Add(rebootonfail);
options.DropDown.Items.Add(remote);
command.Text = "Commande ici";
command.ForeColor = Color.Gray;
command.GotFocus += (ob, ev) =>
{
if (command.Text == "Commande ici")
command.Text = "";
command.ForeColor = Color.Black;
};
command.LostFocus += (ob, ev) =>
{
if (command.Text == "")
command.Text = "Commande ici";
command.ForeColor = Color.Gray;
};
command.KeyDown += (ob, ev) =>
{
if (ev.KeyCode == Keys.Enter)
{
Utility.Sendkeys.Send(Server.Handle, command.Text + "~");
command.Clear();
ev.Handled = ev.SuppressKeyPress = true;
}
};
executer.Text = "Exécuter";
executer.BackColor = c;
executer.Image = ServerManager.Properties.Resources.execute;
executer.DropDown.Items.Add(command);
isvisible.Text = "Visibilité";
isvisible.BackColor = c;
isvisible.Image = ServerManager.Properties.Resources.invisible;
isvisible.Click += (ob, ev) =>
{
isvisible.Image = Utility.View.ChangeVisibility(Server.Handle) ? ServerManager.Properties.Resources.visible : ServerManager.Properties.Resources.invisible;
};
information.Text = "Informations";
information.BackColor = c;
information.Image = ServerManager.Properties.Resources.information;
information.Click += (ob, ev) =>
{
if (Server.IsReady && info != "" && title != "")
MessageBox.Show(this, info, title, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
};
quitter.Text = "Quitter";
quitter.BackColor = c;
quitter.Image = ServerManager.Properties.Resources.exit;
quitter.Click += (ob, ev) =>
{
if (!Server.IsAlive)