本文整理汇总了C#中System.Windows.Forms.ToolStripButton类的典型用法代码示例。如果您正苦于以下问题:C# ToolStripButton类的具体用法?C# ToolStripButton怎么用?C# ToolStripButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolStripButton类属于System.Windows.Forms命名空间,在下文中一共展示了ToolStripButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnBarUpdate
protected override void OnBarUpdate()
{
if (ChartControl == null || _x )
return;
if (!ChartControl.Controls.ContainsKey("TSEco_News"))
{
_myitem0 = new ToolStripSeparator();
_myitem0.Name = "TradingStudiesEcoSeparator";
_myitem1 = new ToolStripButton("Hide News");
_myitem1.Text = "Hide News";
_myitem1.Name = "TradingStudiesEcoNews";
_myitem1.Click += ToolClick1;
_myitem1.Enabled = true;
_myitem1.ForeColor = Color.Black;
_mystrip = (ToolStrip) ChartControl.Controls["tsrTool"];
_mystrip.Items.Add(_myitem0);
_mystrip.Items.Add(_myitem1);
_sp = new Splitter();
_sp.Name = "TSEco_Splitter";
_sp.Dock = _dp == DockingPlace.Below ? DockStyle.Bottom : DockStyle.Top;
ChartControl.Controls.Add(_sp);
_so = new EcoNewsControl.EcoNewsControl(Cbi.Core.InstallDir + @"\Sounds", Cbi.Core.UserDataDir + @"bin\Custom\");
_so.Dock = _dp == DockingPlace.Below ? DockStyle.Bottom : DockStyle.Top;
_so.Name = "TSEco_News";
ChartControl.Controls.Add(_so);
}
else
_so = ChartControl.Controls["TSEco_News"] as EcoNewsControl.EcoNewsControl;
_x = true;
}
示例2: PicoTextEditorForm
public PicoTextEditorForm()
{
InitializeComponent();
AllowBreakpoints = true;
// Initialize info editor.
InfoEditor.Visible = Settings.Default.Pico_AutoAssemble;
InfoEditor.Document.HighlightingStrategy = ICSharpCode.TextEditor.Document.HighlightingStrategyFactory.CreateHighlightingStrategy("Info");
// Create and initialize Auto-assemble button.
var b = new ToolStripButton("Auto-assemble");
b.Checked = Settings.Default.Pico_AutoAssemble;
b.Click +=
(sender, e) =>
{
InfoEditor.Visible = !InfoEditor.Visible;
b.Checked = InfoEditor.Visible;
infoTimer.Enabled = InfoEditor.Visible;
if (!InfoEditor.Visible) errorPanel.Visible = false;
};
statusStrip.Items.Insert(0, b);
Editor.Document.DocumentChanged += new ICSharpCode.TextEditor.Document.DocumentEventHandler(Document_DocumentChanged);
}
示例3: AddNodeButton
private void AddNodeButton(MyNodeConfig nodeInfo, bool isTransform)
{
ToolStripItem newButton = isTransform ? new ToolStripMenuItem() : newButton = new ToolStripButton();
ToolStripItemCollection items;
newButton.Image = nodeInfo.SmallImage;
newButton.Name = nodeInfo.NodeType.Name;
newButton.ToolTipText = nodeInfo.NodeType.Name.Substring(2);
newButton.MouseDown += addNodeButton_MouseDown;
newButton.Tag = nodeInfo.NodeType;
newButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
newButton.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
newButton.ImageTransparentColor = System.Drawing.Color.Magenta;
if (isTransform)
{
newButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
newButton.Text = newButton.ToolTipText;
items = transformMenu.DropDownItems;
}
else
{
items = toolStrip1.Items;
newButton.MouseUp += newButton_MouseUp;
}
if (items.Count > 0 && (items[items.Count - 1].Tag as Type).Namespace != nodeInfo.NodeType.Namespace)
{
items.Add(new ToolStripSeparator());
}
items.Add(newButton);
}
示例4: TweakExecuteControl
public TweakExecuteControl(Tweakable tweakable, string currentState)
: base()
{
this.tweakable = tweakable;
this.state = currentState;
this.Padding = new Padding(0, 0, 7, 0);
Text = "execute";
menu = new ContextMenuStrip();
menu.ShowCheckMargin = false;
menu.ShowImageMargin = false;
menu.ShowItemToolTips = false;
foreach (string setting in tweakable.GetAvailableSettings())
{
ToolStripItem item = new ToolStripButton(setting);
if (setting == currentState)
{
item.Enabled = false;
}
item.Click += Item_Click;
menu.Items.Add(item);
}
}
示例5: FftToolStrip
public FftToolStrip(GraphControl gc, GraphFFT gf)
{
graphControl = gc;
oldGraph = gf;
this.fft = new System.Windows.Forms.ToolStripButton();
this.toolStrip.Dock = System.Windows.Forms.DockStyle.None;
this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fft});
this.toolStrip.Location = new System.Drawing.Point(0, 0);
this.toolStrip.Name = "toolStrip2";
this.toolStrip.Size = new System.Drawing.Size(497, 25);
this.toolStrip.TabIndex = 1;
this.toolStrip.Text = "toolStrip2";
//
// fft
//
this.fft.CheckOnClick = true;
this.fft.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.fft.Image = null;// ((System.Drawing.Image)(resources.GetObject("fft.Image")));
this.fft.ImageTransparentColor = System.Drawing.Color.Magenta;
this.fft.Name = "fft";
this.fft.Size = new System.Drawing.Size(30, 22);
this.fft.Text = "FFT";
this.fft.CheckStateChanged += new System.EventHandler(this.fft_CheckStateChanged);
}
示例6: ZoomAdaptor
public ZoomAdaptor(PicView picView,
ToolStripButton plusBtn,
ToolStripButton minusBtn,
ToolStripComboBox combox)
{
this.picView = picView;
//this.form = form;
this.plusBtn = plusBtn;
this.minusBtn = minusBtn;
this.combox = combox;
picView.ZoomChanged += new EventHandler(zoomChanged);
plusBtn.Click += new EventHandler(btnClick);
minusBtn.Click += new EventHandler(btnClick);
combox.DropDownStyle = ComboBoxStyle.DropDown;
combox.DropDownHeight = 200;
for(int i=20; i<=100; i+=20){
combox.Items.Add(i.ToString() + "%");
}
combox.SelectedIndexChanged += new EventHandler(comboxTextUpdate);
combox.Leave += new EventHandler(comboxTextUpdate);
combox.KeyDown += new KeyEventHandler(comboxKeyDown);
renew();
}
示例7: RegisterToolBoxButton
///<summary>
/// Registers new Tool Box button in main tool-set
///</summary>
///<param name="ownControl">Control owns button will be created</param>
///<param name="item">Instance of <see cref="ToolStripMenuItem"/> which provides information to create button</param>
///<param name="action">Action should be call when created button clicked</param>
///<returns>Action delegate to notify main form when created button should be enabled/disabled</returns>
///<exception cref="FireFlyException"></exception>
public Action<bool> RegisterToolBoxButton([NotNull]Control ownControl, [NotNull]ToolStripMenuItem item, [CanBeNull]EventHandler action)
{
var nb = new ToolStripButton(item.Text, item.Image) { Name = item.Name, ToolTipText = item.ToolTipText, Tag = ownControl, Visible = false};
if (item.ShortcutKeys != Keys.None)
{
#if CHECKERS
if (nb.ToolTipText.IsNull())
{
throw new FireFlyException("{0} has empty ToolTipText property", nb.Name);
}
#endif
nb.ToolTipText += " (" + new KeysConverter().ConvertToString(item.ShortcutKeys) + ")";
}
nb.DisplayStyle = item.Image != null ? ToolStripItemDisplayStyle.Image : ToolStripItemDisplayStyle.Text;
nb.Click += action ?? ((s, e) => item.PerformClick());
nb.Enabled = item.Visible && item.Enabled;
tsMain.Items.Add(nb);
ownControl.GotFocus += (s, e) => nb.Visible = true;
ownControl.LostFocus += (s, e) =>
{
nb.Visible = false;
};
ownControl.Disposed += (s, e) => nb.Dispose();
return isActive =>
{
nb.Enabled = isActive;
item.Visible = isActive;
};
}
示例8: initializeToolStripButtons
protected override void initializeToolStripButtons() {
_tsBtnEditPackage = createToolStripButton("Updatepaket bearbeiten");
_tsBtnRemovePackage = createToolStripButton("Entfernen", "Entfernt des Updatepaket aus dem Projekt.");
_tsBtnEditPackage.Click += _tsBtnEditPackage_Click;
_tsBtnRemovePackage.Click += _tsBtnRemovePackage_Click;
}
示例9: ToolStripViewGui
public ToolStripViewGui()
{
this.Settings = Options.Instance.ViewOptions;
this.mButtonShowLastPackets = new ToolStripButton()
{
Text = "Last packets",
Checked = this.Settings.ShowLastPackets
};
this.mButtonShowLastPackets.Click += new EventHandler(mButtonShowLastPackets_Click);
this.mButtonShowStaticPackets = new ToolStripButton()
{
Text = "Static packets",
Checked = this.Settings.ShowStaticPackets
};
this.mButtonShowStaticPackets.Click += new EventHandler(mButtonShowStaticPackets_Click);
this.mButtonAbout = new ToolStripButton()
{
Text = "About"
};
this.mButtonAbout.Click += new EventHandler(mButtonAbout_Click);
this.Items.AddRange(new ToolStripItem[] { this.mButtonShowLastPackets, this.mButtonShowStaticPackets, this.mButtonAbout });
}
示例10: CreateToolStripButton
private static ToolStripButton CreateToolStripButton(string text, EventHandler onClick = null)
{
ToolStripButton button = new ToolStripButton();
button.Text = text;
button.Click += onClick;
return button;
}
示例11: addtoolstripitem
private void addtoolstripitem(string name, object classobject)
{
if (name == "Seperator")
Items.Add(new ToolStripSeparator());
else
{
bool merge = typeof (MainForm) != classobject.GetType();
var toolstripbutton = new ToolStripButton(name) {Name = name};
EventInfo eventinfo = toolstripbutton.GetType().GetEvent("Click");
// Zoek de string.Format("{0}_Click", name.Replace(" ", "")) methode van classobject
MethodInfo methodinfo =
classobject.GetType().GetMethod(string.Format("{0}_Click", name.Replace(" ", "")));
if (methodinfo == null) // Als die niet bestaat.
toolstripbutton.Enabled = false;
else // Anders, voeg een EventHandler toe van het Click event naar die methode.
eventinfo.AddEventHandler(toolstripbutton,
Delegate.CreateDelegate(eventinfo.EventHandlerType, classobject,
methodinfo));
if (merge)
toolstripbutton.MergeAction = MergeAction.Replace;
Items.Add(toolstripbutton);
itemdictionary.Add(name, toolstripbutton);
}
}
示例12: PHPToolBar
public PHPToolBar()
{
App = (FireEditApplication)FireEditApplication.Istance;
btnCheckSyntax = new ToolStripButton(Properties.Resources.document_check);
btnCheckSyntax.Click += new EventHandler(_CheckSyntax_Click);
btnCheckSyntax.Size = new System.Drawing.Size(22, 22);
btnCheckSyntax.ToolTipText = "Check Syntax Only";
this.Items.Add(btnCheckSyntax);
this.Items.Add("-");
btnRunScript = new ToolStripButton(Properties.Resources.RunScript);
btnRunScript.ToolTipText = "Run Script";
this.Items.Add(btnRunScript);
btnRunScript.Click += new EventHandler(btnRunScript_Click);
this.ImageScalingSize = App.MainForm.MainToolStrip.ImageScalingSize;
this.Size = new Size(10, 25);
this.AutoSize = true;
}
示例13: SubmodulesToolbar
/// <summary>Initializes a new instance of the <see cref="SubmodulesToolbar"/> class.</summary>
/// <param name="submodulesView">Host view.</param>
public SubmodulesToolbar(SubmodulesView submodulesView)
{
Verify.Argument.IsNotNull(submodulesView, "submodulesView");
_submodulesView = submodulesView;
Items.Add(new ToolStripButton(Resources.StrRefresh, CachedResources.Bitmaps["ImgRefresh"],
(sender, e) =>
{
_submodulesView.RefreshContent();
})
{
DisplayStyle = ToolStripItemDisplayStyle.Image,
});
Items.Add(new ToolStripSeparator());
Items.Add(_btnAddSubmodule = new ToolStripButton(Resources.StrAddSubmodule, CachedResources.Bitmaps["ImgSubmoduleAdd"],
(sender, e) =>
{
using(var dlg = new AddSubmoduleDialog(_submodulesView.Repository))
{
dlg.Run(_submodulesView);
}
})
{
DisplayStyle = ToolStripItemDisplayStyle.ImageAndText,
});
}
示例14: ToolStripButtonBlink
public ToolStripButtonBlink(ref ContainerControl ParentControl, ref ToolStripButton TSButton, Image[] ImList)
: this(ref ParentControl,
ref TSButton,
ImList,
new[] {TSButton.ForeColor})
{
}
示例15: StringEditor
public StringEditor()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StringEditor));
txtText = new TextBox();
txtText.Top = 5;
txtText.Left = 50;
txtText.Width = 140;
txtText.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top|AnchorStyles.Right;
txtText.TextChanged += TxtText_TextChanged;
Controls.Add(txtText);
ToolStrip tlsInsert = new ToolStrip();
insertButton = new ToolStripButton();
insertButton.Click += InsertButton_Click;
insertButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
insertButton.Image = ((System.Drawing.Image)(resources.GetObject("toolStripSplitButton1.Image")));
insertButton.ImageTransparentColor = System.Drawing.Color.Magenta;
insertButton.Size = new System.Drawing.Size(32, 22);
tlsInsert.Dock = DockStyle.None;
tlsInsert.Items.Add(insertButton);
tlsInsert.Location = new System.Drawing.Point(0, 2);
Controls.Add(tlsInsert);
}