本文整理汇总了C#中System.Windows.Forms.ToolStripComboBox.FindStringExact方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripComboBox.FindStringExact方法的具体用法?C# ToolStripComboBox.FindStringExact怎么用?C# ToolStripComboBox.FindStringExact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripComboBox
的用法示例。
在下文中一共展示了ToolStripComboBox.FindStringExact方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToolStripDemo
public ToolStripDemo ()
{
this.Text = "ToolStrip Notepad Sample";
this.Size = new Size (750, 450);
this.StartPosition = FormStartPosition.CenterScreen;
image_path = Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "images");
rtb = new TextBox ();
rtb.Multiline = true;
rtb.Dock = DockStyle.Fill;
rtb.BorderStyle = BorderStyle.FixedSingle;
rtb.MouseUp += new MouseEventHandler (rtb_MouseUp);
this.Controls.Add (rtb);
ts = new ToolStrip ();
this.Controls.Add (ts);
Image image1 = Image.FromFile (Path.Combine (image_path, "document-new.png"));
ToolStripButton tb1 = new ToolStripButton ("&New Document", image1, new EventHandler (New_Document_Clicked));
tb1.DisplayStyle = ToolStripItemDisplayStyle.Image;
ts.Items.Add (tb1);
Image image2 = Image.FromFile (Path.Combine (image_path, "document-open.png"));
ToolStripButton tb2 = new ToolStripButton ("&Open Document", image2, new EventHandler (Open_Document_Clicked));
tb2.DisplayStyle = ToolStripItemDisplayStyle.Image;
ts.Items.Add (tb2);
Image image3 = Image.FromFile (Path.Combine (image_path, "document-save.png"));
ToolStripButton tb3 = new ToolStripButton ("&Save Document", image3, new EventHandler (Save_Document_Clicked));
tb3.DisplayStyle = ToolStripItemDisplayStyle.Image;
ts.Items.Add (tb3);
ts.Items.Add (new ToolStripSeparator ());
Image image5 = Image.FromFile (Path.Combine (image_path, "edit-cut.png"));
ToolStripButton tb5 = new ToolStripButton ("Cut", image5, new EventHandler (Cut_Clicked), "Cut");
tb5.DisplayStyle = ToolStripItemDisplayStyle.Image;
tb5.Enabled = false;
ts.Items.Add (tb5);
Image image6 = Image.FromFile (Path.Combine (image_path, "edit-copy.png"));
ToolStripButton tb6 = new ToolStripButton ("Copy", image6, new EventHandler (Copy_Clicked), "Copy");
tb6.DisplayStyle = ToolStripItemDisplayStyle.Image;
ts.Items.Add (tb6);
Image image7 = Image.FromFile (Path.Combine (image_path, "edit-paste.png"));
ToolStripButton tb7 = new ToolStripButton ("Paste", image7, new EventHandler (Paste_Clicked));
tb7.DisplayStyle = ToolStripItemDisplayStyle.Image;
ts.Items.Add (tb7);
ts.Items.Add (new ToolStripSeparator ());
ToolStripLabel tsl = new ToolStripLabel ("Font:");
ts.Items.Add (tsl);
font_combo = new ToolStripComboBox ();
font_combo.DropDownStyle = ComboBoxStyle.DropDownList;
font_combo.AutoSize = false;
font_combo.Width = 150;
InstalledFontCollection ifc = new InstalledFontCollection ();
foreach (FontFamily f in ifc.Families) {
if (f.IsStyleAvailable (FontStyle.Regular))
font_combo.Items.Add (f.Name);
}
font_combo.SelectedIndexChanged += new EventHandler (font_combo_SelectedIndexChanged);
ts.Items.Add (font_combo);
tscb = new ToolStripComboBox ();
tscb.DropDownStyle = ComboBoxStyle.DropDownList;
tscb.Items.Add ("6");
tscb.Items.Add ("8");
tscb.Items.Add ("10");
tscb.Items.Add ("12");
tscb.Items.Add ("14");
tscb.Items.Add ("16");
tscb.Items.Add ("18");
tscb.SelectedIndexChanged += new EventHandler (tscb_SelectedIndexChanged);
tscb.AutoSize = false;
tscb.Width = 45;
ts.Items.Add (tscb);
Image image10 = Image.FromFile (Path.Combine (image_path, "image-x-generic.png"));
font_combo.SelectedIndex = font_combo.FindStringExact (rtb.Font.Name);
tscb.SelectedIndex = tscb.FindStringExact (rtb.Font.Size.ToString ());
ms = new MenuStrip ();
ms.Dock = DockStyle.Top;
this.Controls.Add (ms);
// Top level menu
ToolStripMenuItem mi = new ToolStripMenuItem ("File");
ToolStripMenuItem mi2 = new ToolStripMenuItem ("Edit");
ToolStripMenuItem mi3 = new ToolStripMenuItem ("View");
ToolStripMenuItem mi4 = new ToolStripMenuItem ("Tools");
ToolStripMenuItem mi5 = new ToolStripMenuItem ("Help");
//.........这里部分代码省略.........