本文整理匯總了C#中System.Windows.Forms.ToolStripItem類的典型用法代碼示例。如果您正苦於以下問題:C# ToolStripItem類的具體用法?C# ToolStripItem怎麽用?C# ToolStripItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ToolStripItem類屬於System.Windows.Forms命名空間,在下文中一共展示了ToolStripItem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MapControlAction
public MapControlAction(MapControl control, DisplayToolId id, ToolStripItem[] items)
{
m_Control = control;
m_ToolId = id;
m_Elements = new UserActionSupport(items);
m_Elements.SetHandler(Do);
}
示例2: VerifyMenuItemTextAndChecked
private static void VerifyMenuItemTextAndChecked(ToolStripItem item1, string text, bool fIsChecked)
{
var item = item1 as ToolStripMenuItem;
Assert.IsNotNull(item, "menu item should be ToolStripMenuItem");
Assert.AreEqual(text, item.Text);
Assert.AreEqual(fIsChecked, item.Checked, text + " should be in the expected check state");
}
示例3: Add
public override void Add(ToolStripItem item, IViewModel viewModel)
{
if (_Items == null)
{
_Items = new List<ToolStripItem>();
}
_Items.Add(item);
Pwd.M.ViewModel model = viewModel as Pwd.M.ViewModel;
if (model == null)
{
return;
}
if (item is ToolStripMenuItem)
{
(item as ToolStripMenuItem).Checked = model.CatTreeVisible;
return;
}
if (item is ToolStripButton)
{
(item as ToolStripButton).Checked = model.CatTreeVisible;
return;
}
}
示例4: Add
public override void Add(ToolStripItem item, IViewModel viewModel)
{
if (_Items == null)
{
_Items = new List<ToolStripItem>();
}
_Items.Add(item);
Pwd.M.ViewModel model = viewModel as Pwd.M.ViewModel;
if (model == null)
{
return;
}
bool ok = model.Pattern == CPwd.PATTERN_PRO;
if (item is ToolStripMenuItem)
{
(item as ToolStripMenuItem).Checked = ok;
return;
}
if (item is ToolStripButton)
{
(item as ToolStripButton).Checked = ok;
return;
}
}
示例5: Add
public void Add(ToolStripItem[] toolStripItems,
MenuItem[] menuItems,
EventHandler clickDelegate,
ValidateCommand validateDelegate)
{
_commands.Add(new Command(toolStripItems, menuItems, clickDelegate, validateDelegate));
}
示例6: BeginScrollTimer
private void BeginScrollTimer(ToolStripItem item, Point pntClient) {
int y = pntClient.Y;
int height = item.Bounds.Height;
if(CanScroll && ((y < ((height * 0.5) + 11.0)) || ((Height - (height + 11)) < y))) {
if(timerScroll == null) {
timerScroll = new Timer();
timerScroll.Tick += timerScroll_Tick;
}
else if(timerScroll.Enabled) {
return;
}
timerScroll.Tag = y < ((height * 0.5) + 11.0);
iScrollLine = 1;
if((y < 0x10) || ((Height - 0x10) < y)) {
timerScroll.Interval = 100;
if((y < 9) || ((Height - 9) < y)) {
iScrollLine = 2;
}
}
else {
timerScroll.Interval = 250;
}
fSuppressMouseMove_Scroll = true;
timerScroll.Enabled = false;
timerScroll.Enabled = true;
}
else if(timerScroll != null) {
timerScroll.Enabled = false;
}
}
示例7: Add
public void Add(string key, ToolStripItem item)
{
if (string.IsNullOrEmpty(key))
{
key = "_Item" + _Index++;
}
_Items[key] = item;
if (item is ToolStripMenuItem)
{
if ((item as ToolStripMenuItem).Checked)
{
_Last = item;
}
return;
}
if (item is ToolStripButton)
{
if ((item as ToolStripButton).Checked)
{
_Last = item;
}
return;
}
}
示例8: SetTools
public void SetTools(ToolInfo[] toolInfos)
{
if (this.toolStripEx != null)
{
this.toolStripEx.Items.Clear();
}
this.imageList = new ImageList();
this.imageList.ColorDepth = ColorDepth.Depth32Bit;
this.imageList.TransparentColor = Utility.TransparentKey;
this.toolStripEx.ImageList = this.imageList;
ToolStripItem[] buttons = new ToolStripItem[toolInfos.Length];
string toolTipFormat = PdnResources.GetString("ToolsControl.ToolToolTip.Format");
for (int i = 0; i < toolInfos.Length; ++i)
{
ToolInfo toolInfo = toolInfos[i];
ToolStripButton button = new ToolStripButton();
int imageIndex = imageList.Images.Add(
toolInfo.Image.Reference,
imageList.TransparentColor);
button.ImageIndex = imageIndex;
button.Tag = toolInfo.ToolType;
button.ToolTipText = string.Format(toolTipFormat, toolInfo.Name, char.ToUpperInvariant(toolInfo.HotKey).ToString());
buttons[i] = button;
}
this.toolStripEx.Items.AddRange(buttons);
}
示例9: AddTabPanel
public PanelTabElement AddTabPanel(Panel panel, ToolStripItem button = null)
{
//if (control.GetType() != typeof(Panel))
// throw new PBException("only Panel can be add to PanelTabControl");
PanelTabElement tabElement = new PanelTabElement();
tabElement.Index = _tabControls.Count;
tabElement.Panel = panel;
tabElement.Button = button;
//if (_tabControls.Count == 0)
if (_selectedElement == null)
{
//_selectedIndex = 0;
//_selectedControl = control;
_selectedElement = tabElement;
panel.Visible = true;
if (button != null)
button.BackColor = _buttonSelectedColor;
}
else // if (_tabControls.Count > 0)
{
panel.Visible = false;
if (button != null)
button.BackColor = _buttonUnselectedColor;
}
_tabControlsDictionary.Add(panel, _tabControls.Count);
//_tabControls.Add(control);
_tabControls.Add(tabElement);
this.Controls.Add(panel);
return tabElement;
}
示例10: ToolStripTemplateNode
public ToolStripTemplateNode(IComponent component, string text, Image image)
{
this.component = component;
this.activeItem = component as ToolStripItem;
this._designerHost = (IDesignerHost) component.Site.GetService(typeof(IDesignerHost));
this._designer = this._designerHost.GetDesigner(component);
this._designSurface = (DesignSurface) component.Site.GetService(typeof(DesignSurface));
if (this._designSurface != null)
{
this._designSurface.Flushed += new EventHandler(this.OnLoaderFlushed);
}
if (!isScalingInitialized)
{
if (System.Windows.Forms.DpiHelper.IsScalingRequired)
{
TOOLSTRIP_TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x16);
TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x13);
TOOLSTRIP_TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x5c);
TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x1f);
TEMPLATE_HOTREGION_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(9);
MINITOOLSTRIP_DROPDOWN_BUTTON_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(11);
MINITOOLSTRIP_TEXTBOX_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(90);
}
isScalingInitialized = true;
}
this.SetupNewEditNode(this, text, image, component);
this.commands = new MenuCommand[] {
new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveRight), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Delete), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Cut), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Copy), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeRight), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthIncrease),
new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightDecrease)
};
this.addCommands = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Undo), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Redo) };
}
示例11: AddRange
public void AddRange(ToolStripItem[] value)
{
for (int i = 0; i < value.Length; i++)
{
this.Add(value[i]);
}
}
示例12: AddItem
/// <summary>
/// The add item.
/// </summary>
/// <param name="item">
/// The item.
/// </param>
public void AddItem(ToolStripItem item)
{
if (item != null)
{
this._newItems.Add(item);
}
}
示例13: CombineMenusWithoutAdapterMenuItem
public void CombineMenusWithoutAdapterMenuItem()
{
ContextMenuStrip contextMenuStripFirst = new ContextMenuStrip();
contextMenuStripFirst.Items.Add("item1");
contextMenuStripFirst.Items.Add("item2");
contextMenuStripFirst.Items.Add("item3");
ContextMenuStrip contextMenuStripSecond = new ContextMenuStrip();
contextMenuStripSecond.Items.Add("item4");
contextMenuStripSecond.Items.Add("item5");
Assert.AreEqual(3, contextMenuStripFirst.Items.Count);
Assert.AreEqual(2, contextMenuStripSecond.Items.Count);
// AddRange doesn't work!
// contextMenuStripFirst.Items.AddRange(contextMenuStripSecond.Items);
ToolStripItem[] toolStripItems = new ToolStripItem[contextMenuStripSecond.Items.Count];
contextMenuStripSecond.Items.CopyTo(toolStripItems, 0);
contextMenuStripFirst.Items.AddRange(toolStripItems);
Assert.AreEqual(5, contextMenuStripFirst.Items.Count);
// NB 0 is not what I want; a menuitem can only be part of 1 menu
Assert.AreEqual(0, contextMenuStripSecond.Items.Count);
}
示例14: ToolStripArrowRenderEventArgs
/// <include file='doc\ToolStripArrowRenderEventArgs.uex' path='docs/doc[@for="ToolStripArrowRenderEventArgs.ToolStripArrowRenderEventArgs"]/*' />
public ToolStripArrowRenderEventArgs(Graphics g, ToolStripItem toolStripItem, Rectangle arrowRectangle, Color arrowColor, ArrowDirection arrowDirection) {
this.item = toolStripItem;
this.graphics = g;
this.arrowRect = arrowRectangle;
this.defaultArrowColor = arrowColor;
this.arrowDirection = arrowDirection;
}
示例15: Init
private void Init()
{
CutItem = SPMMenu.Items.CreateCut();
CopyItem = SPMMenu.Items.CreateCopy();
PasteItem = SPMMenu.Items.CreatePaste();
DeleteItem = SPMMenu.Items.CreateDelete();
RefreshItem = SPMMenu.Items.CreateRefresh();
//this.Items.AddRange(new ToolStripItem[] {
// CutItem,
// CopyItem,
// PasteItem,
// DeleteItem,
// SPMMenu.Items.CreateSeparator(),
// RefreshItem
// });
this.Items.AddRange(new ToolStripItem[] {
DeleteItem,
SPMMenu.Items.CreateSeparator(),
RefreshItem
});
this.Name = "BasicMenuStrip";
}