本文整理汇总了C#中System.Windows.Forms.ToolStripDropDown类的典型用法代码示例。如果您正苦于以下问题:C# ToolStripDropDown类的具体用法?C# ToolStripDropDown怎么用?C# ToolStripDropDown使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolStripDropDown类属于System.Windows.Forms命名空间,在下文中一共展示了ToolStripDropDown类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FwPopup
/// ------------------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="FwPopup"/> class.
/// </summary>
/// ------------------------------------------------------------------------------------
public FwPopup()
{
InitializeComponent();
base.DoubleBuffered = true;
if (DesignMode)
return;
base.Dock = DockStyle.Fill;
m_host = new ToolStripControlHost(this);
m_host.Padding = Padding.Empty;
m_host.Margin = Padding.Empty;
m_host.AutoSize = false;
m_host.Size = Size;
m_host.Dock = DockStyle.Fill;
m_owningDropDown = new ToolStripDropDown();
m_owningDropDown.Padding = Padding.Empty;
m_owningDropDown.AutoSize = false;
m_owningDropDown.LayoutStyle = ToolStripLayoutStyle.Table;
m_owningDropDown.Size = Size;
m_owningDropDown.Items.Add(m_host);
m_owningDropDown.VisibleChanged += m_owningDropDown_VisibleChanged;
m_owningDropDown.Opened += m_owningDropDown_Opened;
m_owningDropDown.Closed += m_owningDropDown_Closed;
m_owningDropDown.Opening += m_owningDropDown_Opening;
}
示例2: UndoButton
public UndoButton()
{
// Initialize the custom control
m_dropControl = new UndoDropDownControl()
{
MinimumSize = new Size(SetWidth, SetHeight) // <- important
};
m_dropControl.ItemChosen += m_dropControl_ItemChosen;
// ...hosted by a ToolStripControlHost
m_toolHost = new ToolStripControlHost(m_dropControl)
{
Size = new Size(SetWidth, SetHeight),
Margin = new Padding(0)
};
// ... and shown in a ToolStripDropDown.
m_toolDrop = new ToolStripDropDown()
{
Padding = new Padding(0)
};
m_toolDrop.Items.Add(m_toolHost);
this.DisplayStyle = ToolStripItemDisplayStyle.Image;
this.BackgroundImageLayout = ImageLayout.Stretch;
// There is no OnDropDownOpening to override, so I guess we have to do it this way.
this.DropDownOpening += UndoButton_DropDownOpening;
}
示例3: AddControl
public void AddControl( IComboBoxExtender child )
{
try {
childControl = child;
childControl.SetUserInterface ( );
treeViewHost = new ToolStripControlHost ( childControl as Control );
treeViewHost.Visible = false;
CloseComboBoxExtenderHandler closeCombo = new CloseComboBoxExtenderHandler ( CloseComboBox );
childControl.CloseComboBoxExtenderDelegate = closeCombo;
dropDown = new ToolStripDropDown ( );
dropDown.Items.Add ( treeViewHost );
dropDown.AutoClose = true;
this.DropDownStyle = ComboBoxStyle.DropDownList;
dropDown.Closed += new ToolStripDropDownClosedEventHandler ( DropDownClosed );
this.EnabledChanged += new EventHandler ( ExtenderCombo_EnabledChanged );
closeCombo ( );
} catch ( Exception ex ) {
MessageBox.Show ( ex.Message );
}
}
示例4: ApplySkin
public static void ApplySkin(ToolStripDropDown dropDown)
{
dropDown.Renderer = new MenuRenderer();
var size = MeasureDropDown(dropDown);
dropDown.Width = size.Width;
dropDown.Height = size.Height + 5;
}
示例5: LayerManagerPanel
public LayerManagerPanel()
{
InitializeComponent();
// Create other command
var control = new LayerControl();
control.ControlsClicked += LayerCommand_ControlsClicked;
// Add to dropdown list
var dropdown = new ToolStripDropDown();
dropdown.Items.Add(new ToolStripControlHost(control));
btnLayer.DropDown = dropdown;
// Add sign
btnAdd.Tag = LayerCommand.Add;
// Set border width
_borderWidth = 4F;
// Set serveral option for paint
SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.ResizeRedraw |
ControlStyles.UserPaint, true);
}
示例6: AddContributions_Helper
/// <summary>
/// Used by AddContributions to add new ContextMenu Items to a Menu they are about to Display
/// </summary>
/// <param name="strip">The form's menu</param>
/// <param name="itemsIn">New Items to Add</param>
public static void AddContributions_Helper(ToolStripDropDown strip, List<ToolStripMenuItem> itemsIn)
{
if (itemsIn == null || itemsIn.Count == 0) return;
List<ToolStripItem> items = new List<ToolStripItem>();
itemsIn.ForEach(o =>
{
string txt = (o.Text ?? "").ToLower().Trim();
foreach (var i in strip.Items)
{
ToolStripItem item = (ToolStripItem)i;
if (txt != (item.Text ?? "").ToLower().Trim()) continue;
txt = null;
break;
}
foreach (var item in items)
{
if (txt != (item.Text ?? "").ToLower().Trim()) continue;
txt = null;
break;
}
if (txt != null) items.Add(o);
});
if (items.Count == 0) return;
if (strip.Items.Count > 0)
items.Insert(0, new ToolStripSeparator());
strip.Items.AddRange(items.ToArray());
strip.Closing += ((sender, args) => items.ForEach((o) => strip.Items.Remove(o)));
}
示例7: LineSetPanel
public LineSetPanel()
{
InitializeComponent();
MouseWheel += LineSetPanel_MouseWheel;
_popup = new ToolStripDropDown();
_selectedLines = new List<Line>();
UseProjection = true;
}
示例8: NewPopup
public static ToolStripDropDown NewPopup(Control contents)
{
var strip = new ToolStripDropDown();
var host = new ToolStripControlHost(contents);
strip.Items.Add(host);
host.Margin = new Padding(0);
return strip;
}
示例9: AppendMenuItems
public override bool AppendMenuItems(ToolStripDropDown menu)
{
// Place a call to the base class to ensure the default parameter menu is still there and operational.
base.AppendAdditionalComponentMenuItems(menu);
// Now insert your own custom menu items.
//Menu_AppendSeparator(menu);
Menu_AppendTextItem(menu, this.ComponentName, Menu_ParentLayerNameKeyDown, Menu_ParentLayerNameChanged, true);
//Menu_AppendItem(menu, "Run Lemmings!", Menu_RunLemmingsClicked);
return true;
}
示例10: AppendMenuItems
public override bool AppendMenuItems(ToolStripDropDown iMenu)
{
var toReturn = base.AppendMenuItems(iMenu);
{
var tsi = GetTargetVariableMenuItem();
iMenu.Items.Insert(Math.Min(iMenu.Items.Count, 1), tsi);
}
return toReturn;
}
示例11: CommandMenuBuilder
public CommandMenuBuilder()
{
menu = new ContextMenuStrip();
menu.ShowCheckMargin = false;
menu.ShowImageMargin = false;
menu.SuspendLayout();
menu.Opening +=new System.ComponentModel.CancelEventHandler(menu_Opening);
menu.Closed += new ToolStripDropDownClosedEventHandler(menu_Closed);
currentMenu = menu;
currentButtonBar = new List<ToolStripButton>();
}
示例12: Layout
public void Layout ()
{
ToolStripDropDown drop_down = new ToolStripDropDown ();
drop_down.Items.Add (new ToolStripVariableSizeItem ());
drop_down.PerformLayout ();
// We want to be sure the DropDown is using the size provided
// by GetPreferredSize, not DefaultSize, and since the extra padding/margin
// can change by some few pixels, we do a light check
Assert.AreEqual (true, drop_down.Size.Width >= 100, "A1");
Assert.AreEqual (true, drop_down.Size.Height >= 100, "A2");
}
示例13: CheckComboBox
public CheckComboBox()
: base()
{
m_checkListBox = new CheckListBox();
m_checkListBox.Dock = DockStyle.Fill;
m_checkListBox.ItemChecked += new ItemCheckedEventHandler(m_checkListBox_ItemChecked);
m_dropDown = new ToolStripDropDown();
m_dropDown.Margin = new Padding(0);
m_dropDown.Padding = new Padding(1);
m_dropDown.Items.Add(new ToolStripControlHost(m_checkListBox));
m_dropDown.Closing += new ToolStripDropDownClosingEventHandler(m_dropDown_Closing);
}
示例14: AppendMenuItems
// Overrides the default menu of grasshopper (useful)
public override bool AppendMenuItems(ToolStripDropDown menu)
{
Menu_AppendItem(menu, "First item");
Menu_AppendItem(menu, "Second item");
Menu_AppendItem(menu, "Third item");
Menu_AppendSeparator(menu);
Menu_AppendItem(menu, "Fourth item");
Menu_AppendItem(menu, "Fifth item");
Menu_AppendItem(menu, "Sixth item");
// Return true, otherwise the menu won't be shown.
return true;
}
示例15: AppendMenuItems
public override bool AppendMenuItems(ToolStripDropDown menu)
{
// Place a call to the base class to ensure the default parameter menu is still there and operational.
//base.AppendAdditionalComponentMenuItems(menu);
// Now insert your own custom menu items.
//Menu_AppendItem(menu, "1 Parameter", Menu_ChangeParamCount, true, true);
//Menu_AppendItem(menu, "2 Parameters", Menu_ChangeParamCount, true, false);
//Menu_AppendItem(menu, "3 Parameters", Menu_ChangeParamCount, true, false);
//Menu_AppendSeparator(menu);
Menu_AppendItem(menu, "Run Lemmings!", Menu_RunLemmingsClicked);
return true;
}