本文整理汇总了C#中System.Windows.Forms.ToolStripManager.FindToolStrip方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripManager.FindToolStrip方法的具体用法?C# ToolStripManager.FindToolStrip怎么用?C# ToolStripManager.FindToolStrip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripManager
的用法示例。
在下文中一共展示了ToolStripManager.FindToolStrip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: applyButton_Click
// This event handler is invoked when
// the "Apply Renderers" button is clicked.
// Depending on the value selected in a ComboBox control,
// it applies a custom renderer selectively to
// individual MenuStrip or ToolStrip controls,
// or it applies a custom renderer to the
// application as a whole.
void applyButton_Click(object sender, EventArgs e)
{
ToolStrip ms = ToolStripManager.FindToolStrip("MenuStrip");
ToolStrip ts = ToolStripManager.FindToolStrip("ToolStrip");
if (targetComboBox.SelectedItem != null)
{
switch (targetComboBox.SelectedItem.ToString())
{
case "Reset":
{
ms.RenderMode = ToolStripRenderMode.ManagerRenderMode;
ts.RenderMode = ToolStripRenderMode.ManagerRenderMode;
// Set the default RenderMode to Professional.
ToolStripManager.RenderMode = ToolStripManagerRenderMode.Professional;
break;
}
case "All":
{
ms.RenderMode = ToolStripRenderMode.ManagerRenderMode;
ts.RenderMode = ToolStripRenderMode.ManagerRenderMode;
// Assign the custom renderer at the application level.
ToolStripManager.Renderer = new CustomProfessionalRenderer();
break;
}
case "MenuStrip":
{
// Assign the custom renderer to the MenuStrip control only.
ms.Renderer = new CustomProfessionalRenderer();
break;
}
case "ToolStrip":
{
// Assign the custom renderer to the ToolStrip control only.
ts.Renderer = new CustomProfessionalRenderer();
break;
}
}
}
}