本文整理汇总了C#中System.Windows.Forms.ToolStripItem类的典型用法代码示例。如果您正苦于以下问题:C# ToolStripItem类的具体用法?C# ToolStripItem怎么用?C# ToolStripItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolStripItem类属于System.Windows.Forms命名空间,在下文中一共展示了ToolStripItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:steve-stanton,项目名称:backsight,代码行数:7,代码来源:MapControlAction.cs
示例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");
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:7,代码来源:InMemoryLogicTest.cs
示例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;
}
}
开发者ID:burstas,项目名称:rmps,代码行数:25,代码来源:CatTreeVisibleAction.cs
示例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;
}
}
开发者ID:burstas,项目名称:rmps,代码行数:26,代码来源:ProPatternAction.cs
示例5: Add
public void Add(ToolStripItem[] toolStripItems,
MenuItem[] menuItems,
EventHandler clickDelegate,
ValidateCommand validateDelegate)
{
_commands.Add(new Command(toolStripItems, menuItems, clickDelegate, validateDelegate));
}
开发者ID:applejian,项目名称:cyberduck,代码行数:7,代码来源:Commands.cs
示例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;
}
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:30,代码来源:DropDownMenuDropTarget.cs
示例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;
}
}
开发者ID:burstas,项目名称:rmps,代码行数:25,代码来源:ItemGroup.cs
示例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);
}
开发者ID:metadeta96,项目名称:openpdn,代码行数:33,代码来源:ToolsControl.cs
示例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;
}
开发者ID:labeuze,项目名称:source,代码行数:30,代码来源:PanelTabControl.cs
示例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) };
}
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:32,代码来源:ToolStripTemplateNode.cs
示例11: AddRange
public void AddRange(ToolStripItem[] value)
{
for (int i = 0; i < value.Length; i++)
{
this.Add(value[i]);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:CustomMenuItemCollection.cs
示例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);
}
}
开发者ID:tu-tran,项目名称:FareLiz,代码行数:13,代码来源:FlightDataListViewEventHandlers.cs
示例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);
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:26,代码来源:MenuItemContextMenuStripAdapterTest.cs
示例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;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:ToolStripArrowRenderEventArgs.cs
示例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";
}
开发者ID:lucaslra,项目名称:SPM,代码行数:25,代码来源:MenuStripStandard.cs
示例16: EnterPrintPreviewDialog
/// <summary>
/// Constructor for the Print Preview dialog
/// </summary>
public EnterPrintPreviewDialog()
{
Type t = typeof(PrintPreviewDialog);
FieldInfo fieldInfo = t.GetField("toolStrip1", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo fieldInfo2 = t.GetField("printToolStripButton", BindingFlags.Instance | BindingFlags.NonPublic);
ToolStrip toolStrip1 = (ToolStrip)fieldInfo.GetValue(this);
ToolStripButton printButton = (ToolStripButton)fieldInfo2.GetValue(this);
printButton.Visible = false;
enterPrintButton = new ToolStripButton();
enterPrintButton.ToolTipText = printButton.ToolTipText;
enterPrintButton.ImageIndex = 0;
ToolStripItem[] oldButtons = new ToolStripItem[toolStrip1.Items.Count];
for (int i = 0; i < oldButtons.Length; i++)
{
oldButtons[i] = toolStrip1.Items[i];
}
toolStrip1.Items.Clear();
toolStrip1.Items.Add(enterPrintButton);
for (int i = 0; i < oldButtons.Length; i++)
{
toolStrip1.Items.Add(oldButtons[i]);
}
toolStrip1.ItemClicked += new ToolStripItemClickedEventHandler(toolStrip1_ItemClicked);
}
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:35,代码来源:PrintPreviewDialog.cs
示例17: InitializeItem
protected override void InitializeItem(ToolStripItem item)
{
base.InitializeItem(item);
// Set default blank image to look ok in high dpi
if (item.Image == null && item.IsOnDropDown)
{
item.Image = PluginBase.MainForm.FindImage("559");
}
if (item is ToolStripButton)
{
Double scale = ScaleHelper.GetScale();
if (scale >= 1.5)
{
item.Padding = new Padding(4, 2, 4, 2);
}
else if (scale >= 1.2)
{
item.Padding = new Padding(2, 1, 2, 1);
}
else if (renderer is ToolStripSystemRenderer && Win32.IsRunningOnWindows())
{
item.Padding = new Padding(2, 2, 2, 2);
}
}
else if (item is ToolStripComboBoxEx)
{
ToolStripComboBoxEx comboBox = item as ToolStripComboBoxEx;
comboBox.Margin = new Padding(2, 0, 2, 0);
comboBox.FlatCombo.UseTheme = useTheme;
}
}
开发者ID:ImaginationSydney,项目名称:flashdevelop,代码行数:31,代码来源:DockPanelStripRenderer.cs
示例18: ChangeImage
public static void ChangeImage(ToolStripItem item, Image itemImage)
{
MethodInvoker method = null;
if (item.Image != itemImage)
{
if ((item.Owner != null) && item.Owner.InvokeRequired)
{
if (method == null)
{
method = delegate {
lock (itemImage)
{
item.Image = itemImage;
}
};
}
item.Owner.BeginInvoke(method);
}
else
{
lock (itemImage)
{
item.Image = itemImage;
}
}
}
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:27,代码来源:VirtualItemToolStripEvents.cs
示例19: ApplyLanguage
protected void ApplyLanguage(ToolStripItem applyTo, string languageKey)
{
if (!string.IsNullOrEmpty(languageKey))
{
if (!Language.hasKey(languageKey))
{
LOG.WarnFormat("Wrong language key '{0}' configured for control '{1}'", languageKey, applyTo.Name);
if (DesignMode)
{
MessageBox.Show(string.Format("Wrong language key '{0}' configured for control '{1}'", languageKey, applyTo.Name));
}
return;
}
applyTo.Text = Language.GetString(languageKey);
}
else
{
// Fallback to control name!
if (Language.hasKey(applyTo.Name))
{
applyTo.Text = Language.GetString(applyTo.Name);
return;
}
if (this.DesignMode)
{
MessageBox.Show(string.Format("Greenshot control without language key: {0}", applyTo.Name));
}
else
{
LOG.DebugFormat("Greenshot control without language key: {0}", applyTo.Name);
}
}
}
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:33,代码来源:GreenshotForm.cs
示例20: EditorToolStrip
public EditorToolStrip()
{
var dropDown = new ToolStripDropDownButton();
dropDown.Text = "Style";
dropDown.Alignment = ToolStripItemAlignment.Right;
dropDown.DropDownItems.Add("Default");
dropDown.DropDownItems.Add("GitHub");
var items = new ToolStripItem[] {
dropDown,
new ToolStripMenuItem("Some Button")
};
this._dataSourceMock = new Mock<IEditorToolStripDataSource>();
this._dataSourceMock.Setup(m => m.NumberOfEditorToolStripItems(It.IsAny<Model.EditorToolStrip>()))
.Returns(items.Length)
.Verifiable();
this._dataSourceMock.Setup(m => m.EditorToolStripItemForIndex(It.IsAny<Model.EditorToolStrip>(), It.IsAny<int>()))
.Returns<Model.EditorToolStrip, int>((inst, index) =>
{
return items[index];
})
.Verifiable();
this._subject = new Model.EditorToolStrip(this._dataSourceMock.Object, null);
}
开发者ID:pseudomuto,项目名称:muto-mark,代码行数:27,代码来源:EditorToolStrip.cs
注:本文中的System.Windows.Forms.ToolStripItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论