本文整理汇总了C#中System.Windows.Forms.ToolBar类的典型用法代码示例。如果您正苦于以下问题:C# ToolBar类的具体用法?C# ToolBar怎么用?C# ToolBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolBar类属于System.Windows.Forms命名空间,在下文中一共展示了ToolBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetExtendedToolBar
internal ToolBar GetExtendedToolBar(ToolBar toolbar)
{
// filtet the images that are applicable.
_automationToolbar = toolbar;
toolbar.ButtonSize = new Size(5, 5);
int buttonLength = toolbar.Buttons.Count;
for (int i = 0; i < buttonLength; ++i)
{
ToolBarButton button = toolbar.Buttons[i];
string toolText = button.ToolTipText;
if (Array.IndexOf(allowedEditButtons, toolText) < 0)
{
button.Visible = false;
// button.M
}
if (button.ToolTipText.Equals("Stamp", StringComparison.CurrentCultureIgnoreCase))
{
button.ToolTipText = "Signature";
}
}
return toolbar;
}
示例2: MyWindow
public MyWindow()
: base()
{
Menu = new MainMenu();
Menu.MenuItems.Add("File");
Menu.MenuItems.Add("Edit");
Menu.MenuItems.Add("View");
Menu.MenuItems.Add("Help");
Bitmap bm = new Bitmap(GetType(), "SimpleToolbar.bmp");
ImageList imglist = new ImageList();
imglist.Images.AddStrip(bm);
imglist.TransparentColor = Color.LightBlue;
ToolBar tb = new ToolBar();
tb.Parent = this;
tb.ShowToolTips = true;
string[] astr = { "New", "Open", "Save", "Print", "Cut", "Copy", "Paste" };
for (int i = 0; i < 7; i++)
{
ToolBarButton tbb = new ToolBarButton();
tbb.ImageIndex = i;
tbb.ToolTipText = astr[i];
tb.Buttons.Add(tbb);
}
}
示例3: IDialog
public IDialog()
: base()
{
// Button
resultButton = new ResultButton();
this.Controls.Add(resultButton);
this.toolBar = new System.Windows.Forms.ToolBar();
this.tbOkButton = new System.Windows.Forms.ToolBarButton();
this.tbCancelButton = new System.Windows.Forms.ToolBarButton();
//
// toolBar
//
this.toolBar.Buttons.Add(this.tbOkButton);
this.toolBar.Buttons.Add(this.tbCancelButton);
this.toolBar.Name = "toolBar";
this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
this.Controls.Add(this.toolBar);
// Toolbar
string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
ToolbarMaker.ToolBar = toolBar;
ToolbarMaker.AddIcon(appPath + @"\Icons\tbOk");
ToolbarMaker.AddIcon(appPath + @"\Icons\tbCancel");
this.TopMost = true;
}
示例4: InitializeMyToolBar
static public void InitializeMyToolBar(Form form)
{
// Create and initialize the ToolBar and ToolBarButton controls.
ToolBar toolBar1 = new ToolBar();
ToolBarButton toolBarButton1 = new ToolBarButton();
ToolBarButton toolBarButton2 = new ToolBarButton();
ToolBarButton toolBarButton3 = new ToolBarButton();
// Set the Text properties of the ToolBarButton controls.
toolBarButton1.Text = "Open";
toolBarButton2.Text = "Save";
toolBarButton3.Text = "Print";
// Add the ToolBarButton controls to the ToolBar.
toolBar1.Buttons.Add(toolBarButton1);
toolBar1.Buttons.Add(toolBarButton2);
toolBar1.Buttons.Add(toolBarButton3);
//Add the event-handler delegate.
toolBar1.ButtonClick += new ToolBarButtonClickEventHandler (
toolBar1_ButtonClick);
// Add the ToolBar to the Form.
form.Controls.Add(toolBar1);
}
示例5: Initialize
public override void Initialize() {
AutoScrollCanvas = true;
windowSD = ScrollControl.ScrollDirector;
documentSD = new DocumentScrollDirector();
ToolBar toolBar = new ToolBar();
ToolBarButton btnWindow = new ToolBarButton(WINDOW_LABEL);
ToolBarButton btnDocument = new ToolBarButton(DOCUMENT_LABEL);
toolBar.Buttons.Add(btnWindow);
toolBar.Buttons.Add(btnDocument);
toolBar.ButtonClick += new ToolBarButtonClickEventHandler(toolBar_ButtonClick);
this.Controls.Add(toolBar);
ScrollControl.Bounds = new Rectangle(ClientRectangle.X, toolBar.Bottom, ScrollControl.Width, ScrollControl.Height - toolBar.Height);
// Make some rectangles on the surface so we can see where we are
for (int x = 0; x < 20; x++) {
for (int y = 0; y < 20; y++) {
if (((x + y) % 2) == 0) {
PPath path = PPath.CreateRectangle(50 * x, 50 * y, 40, 40);
path.Brush = Brushes.Blue;
path.Pen = Pens.Black;
Canvas.Layer.AddChild(path);
}
else if (((x + y) % 2) == 1) {
PPath path = PPath.CreateEllipse(50 * x, 50 * y, 40, 40);
path.Brush = Brushes.Blue;
path.Pen = Pens.Black;
Canvas.Layer.AddChild(path);
}
}
}
}
示例6: Form1
public Form1()
{
InitializeComponent();
list = new ImageList();
list.ImageSize = new Size(50, 50);
list.Images.Add(new Bitmap("open.bmp"));
list.Images.Add(new Bitmap("save.bmp"));
list.Images.Add(new Bitmap("exit.bmp"));
tBar = new ToolBar();
tBar.ImageList = list; //привяжем список картинок к тулбару
ToolBarButton toolBarButton1 = new ToolBarButton();
ToolBarButton toolBarButton2 = new ToolBarButton();
ToolBarButton toolBarButton3 = new ToolBarButton();
ToolBarButton separator = new ToolBarButton();
separator.Style = ToolBarButtonStyle.Separator;
toolBarButton1.ImageIndex = 0; //Open
toolBarButton2.ImageIndex = 1;// save
toolBarButton3.ImageIndex = 2; //exit
tBar.Buttons.Add(toolBarButton1);
tBar.Buttons.Add(separator);
tBar.Buttons.Add(toolBarButton2);
tBar.Buttons.Add(separator);
tBar.Buttons.Add(toolBarButton3);
tBar.Appearance = ToolBarAppearance.Flat;
tBar.BorderStyle = BorderStyle.Fixed3D;
tBar.ButtonClick += new ToolBarButtonClickEventHandler(tBar_ButtonClick);
this.Controls.Add(tBar);
}
示例7: Install
{ public static void Install (Panel ParentArg)
{ T_New New = new T_New (0) ;
T_Open Open = new T_Open (1) ;
T_Save Save = new T_Save (2) ;
T_SaveAll SaveAll = new T_SaveAll (3) ;
T_Close Close = new T_Close (4) ;
T_Cut Cut = new T_Cut (5) ;
T_Copy Copy = new T_Copy (6) ;
T_Paste Paste = new T_Paste (7) ;
T_Undo Undo = new T_Undo (8) ;
T_ColorHighlighter ColorHighlighter = new T_ColorHighlighter (9) ;
T_Search Search = new T_Search (10) ;
T_Print Print = new T_Print (11) ;
ToolBarButton Spacer = new ToolBarButton () ;
Spacer.Style = ToolBarButtonStyle.Separator ;
ImageList List = new ImageList () ;
List.Images.Add (New.GetBMP()) ;
List.Images.Add (Open.GetBMP()) ;
List.Images.Add (Save.GetBMP()) ;
List.Images.Add (SaveAll.GetBMP()) ;
List.Images.Add (Close.GetBMP()) ;
List.Images.Add (Cut.GetBMP()) ;
List.Images.Add (Copy.GetBMP()) ;
List.Images.Add (Paste.GetBMP()) ;
List.Images.Add (Undo.GetBMP()) ;
List.Images.Add (ColorHighlighter.GetBMP()) ;
List.Images.Add (Search.GetBMP()) ;
List.Images.Add (Print.GetBMP()) ;
ToolBar Bar = new ToolBar () ;
Bar.Parent = ParentArg ;
Bar.ImageList = List ;
Bar.ShowToolTips = true ;
Bar.ButtonClick += new ToolBarButtonClickEventHandler (BarClick) ;
Bar.Buttons.Add (New) ;
Bar.Buttons.Add (Open) ;
Bar.Buttons.Add (Save) ;
Bar.Buttons.Add (SaveAll) ;
Bar.Buttons.Add (Close) ;
Bar.Buttons.Add (Spacer) ;
Bar.Buttons.Add (Cut) ;
Bar.Buttons.Add (Copy) ;
Bar.Buttons.Add (Paste) ;
Bar.Buttons.Add (Spacer) ;
Bar.Buttons.Add (Undo) ;
Bar.Buttons.Add (ColorHighlighter) ;
Bar.Buttons.Add (Search) ;
Bar.Buttons.Add (Print) ;
}
示例8: MxToolBarSubclasser
public MxToolBarSubclasser(System.Windows.Forms.ToolBar toolBar)
{
if (toolBar == null)
{
throw new ArgumentNullException();
}
this._toolBar = toolBar;
this._painter = new MxToolBarPainter(this._toolBar);
}
示例9: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof (ListToolBarControl));
this.toolBar = new System.Windows.Forms.ToolBar();
this.tbtnPasteList = new System.Windows.Forms.ToolBarButton();
this.tbtnSeparator = new System.Windows.Forms.ToolBarButton();
this.imageList = new System.Windows.Forms.ImageList(this.components);
this.tbtnAppendList = new System.Windows.Forms.ToolBarButton();
this.SuspendLayout();
//
// toolBar
//
this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[]{
this.tbtnPasteList,
this.tbtnAppendList,
this.tbtnSeparator
});
this.toolBar.DropDownArrows = true;
this.toolBar.ImageList = this.imageList;
this.toolBar.Location = new System.Drawing.Point(0, 0);
this.toolBar.Name = "toolBar";
this.toolBar.ShowToolTips = true;
this.toolBar.Size = new System.Drawing.Size(64, 30);
this.toolBar.TabIndex = 0;
this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
//
// tbtnPasteList
//
this.tbtnPasteList.ImageIndex = 0;
this.tbtnPasteList.Tag = "PasteList";
this.tbtnPasteList.ToolTipText = "Paste list";
//
// tbtnSeparator
//
this.tbtnSeparator.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// imageList
//
this.imageList.ImageSize = new System.Drawing.Size(19, 18);
this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
this.imageList.TransparentColor = System.Drawing.Color.Transparent;
//
// tbtnAppendList
//
this.tbtnAppendList.ImageIndex = 1;
this.tbtnAppendList.Tag = "AppendList";
this.tbtnAppendList.ToolTipText = "Append list";
//
// ListToolBarControl
//
this.Controls.Add(this.toolBar);
this.Name = "ListToolBarControl";
this.Size = new System.Drawing.Size(64, 32);
this.ResumeLayout(false);
}
示例10: InitializeComponent
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.ToolBar = new System.Windows.Forms.ToolBar();
this.ImgList = new System.Windows.Forms.ImageList(this.components);
this.pnlToolbarPadding = new System.Windows.Forms.Panel();
this.CurrentToolTip = new System.Windows.Forms.ToolTip(this.components);
this.pnlToolbarPadding.SuspendLayout();
this.SuspendLayout();
//
//ToolBar
//
this.ToolBar.Anchor = (System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right));
this.ToolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
this.ToolBar.AutoSize = false;
this.ToolBar.ButtonSize = new System.Drawing.Size(16, 16);
this.ToolBar.Divider = false;
this.ToolBar.Dock = System.Windows.Forms.DockStyle.None;
this.ToolBar.DropDownArrows = true;
this.ToolBar.ImageList = this.ImgList;
this.ToolBar.Location = new System.Drawing.Point(8, 1);
this.ToolBar.Name = "ToolBar";
this.ToolBar.ShowToolTips = true;
this.ToolBar.Size = new System.Drawing.Size(580, 26);
this.ToolBar.TabIndex = 0;
//
//ImgList
//
this.ImgList.ColorDepth = System.Windows.Forms.ColorDepth.Depth16Bit;
this.ImgList.ImageSize = new System.Drawing.Size(16, 16);
this.ImgList.TransparentColor = System.Drawing.Color.Transparent;
//
//pnlToolbarPadding
//
this.pnlToolbarPadding.Controls.Add(this.ToolBar);
this.pnlToolbarPadding.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlToolbarPadding.DockPadding.Left = 8;
this.pnlToolbarPadding.DockPadding.Right = 8;
this.pnlToolbarPadding.Location = new System.Drawing.Point(0, 0);
this.pnlToolbarPadding.Name = "pnlToolbarPadding";
this.pnlToolbarPadding.Size = new System.Drawing.Size(600, 28);
this.pnlToolbarPadding.TabIndex = 1;
//
//CurrentToolTip
//
this.CurrentToolTip.ShowAlways = true;
//
//GISAControl
//
this.Controls.Add(this.pnlToolbarPadding);
this.Name = "GISAControl";
this.Size = new System.Drawing.Size(600, 280);
this.pnlToolbarPadding.ResumeLayout(false);
this.ResumeLayout(false);
}
示例11: ToolbarLayout
public ToolbarLayout ()
{
toolbar = new ToolBar();
toolbar.Appearance = ToolBarAppearance.Flat;
//toolbar.ButtonSize = new Size(8, 8);
toolbar.Buttons.Add("Image");
toolbar.Buttons.Add("NoImage");
toolbar.Buttons.Add("Blahblahblah");
toolbar.Dock = DockStyle.Top;
Controls.Add (toolbar);
Panel fmt_frame = new Panel ();
fmt_frame.Dock = DockStyle.Fill;
Controls.Add (fmt_frame);
chkbox_appearance = new CheckBox ();
chkbox_appearance.Text = "Flat";
chkbox_appearance.Checked = true;
chkbox_appearance.CheckedChanged += new EventHandler (AppearanceChanged);
chkbox_appearance.Location = new Point (10, 10);
chkbox_appearance.Size = new Size (100, 20);
fmt_frame.Controls.Add (chkbox_appearance);
chkbox_btnsize = new CheckBox ();
chkbox_btnsize.Text = "Button Size";
chkbox_btnsize.Checked = false;
chkbox_btnsize.CheckedChanged += new EventHandler (ButtonSizeChanged);
chkbox_btnsize.Location = new Point (10, 40);
chkbox_btnsize.Size = new Size (100, 20);
fmt_frame.Controls.Add (chkbox_btnsize);
txt_width = new TextBox ();
txt_width.Location = new Point (110, 40);
txt_width.Size = new Size (50, 20);
fmt_frame.Controls.Add (txt_width);
txt_height = new TextBox ();
txt_height.Location = new Point (170, 40);
txt_height.Size = new Size (50, 20);
fmt_frame.Controls.Add (txt_height);
chkbox_images = new CheckBox ();
chkbox_images.Text = "Show Images";
chkbox_images.Checked = false;
chkbox_images.CheckedChanged += new EventHandler (ImagesChanged);
chkbox_images.Location = new Point (10, 70);
chkbox_images.Size = new Size (100, 20);
fmt_frame.Controls.Add (chkbox_images);
chkbox_align = new CheckBox ();
chkbox_align.Text = "Text Underneath";
chkbox_align.Checked = true;
chkbox_align.CheckedChanged += new EventHandler (AlignmentChanged);
chkbox_align.Location = new Point (10, 100);
chkbox_align.Size = new Size (150, 20);
fmt_frame.Controls.Add (chkbox_align);
images.ColorDepth = ColorDepth.Depth32Bit;
images.Images.Add (new Bitmap ("image1.bmp"));
images.ImageSize = new Size (40, 40);
}
示例12: CanExtendTest
public void CanExtendTest ()
{
Control myControl = new Control ();
Form myForm = new Form ();
myForm.ShowInTaskbar = false;
ToolBar myToolBar = new ToolBar ();
ErrorProvider myErrorProvider = new ErrorProvider ();
Assert.AreEqual (myErrorProvider.CanExtend (myControl), true, "#ext1");
Assert.AreEqual (myErrorProvider.CanExtend (myToolBar), false, "#ext2");
Assert.AreEqual (myErrorProvider.CanExtend (myForm), false, "#ext3");
myForm.Dispose ();
}
示例13: PtxToolBar
public PtxToolBar()
{
m_ToolBar = new ToolBar();
m_ToolBar.ButtonClick += new ToolBarButtonClickEventHandler(
this.OnToolBarClick);
m_ButtonList = new FRList<PtxToolButton>();
m_ToolBar.TextAlign = ToolBarTextAlign.Right;
m_ToolBar.AutoSize = false;
m_ToolBar.Height = 25;
m_ToolBar.ButtonSize = new System.Drawing.Size(30, 20);
}
示例14: SaveToolBarToFile
public static void SaveToolBarToFile(ToolBar pButtons, string pFile)
{
if (string.IsNullOrEmpty(pFile))
{
return;
}
if (pButtons == null)
{
return;
}
FileFunctions.SaveTextFile(pFile, pButtons.GetXml(), false);
}
示例15: InitializeComponent
private void InitializeComponent() {
this.components = new Container();
ResourceManager resources = new ResourceManager(typeof (ScalerToolBarControl));
this.toolBar = new ToolBar();
this.tbtnScaleUp = new ToolBarButton();
this.tbtnScaleDown = new ToolBarButton();
this.imageList = new ImageList(this.components);
this.SuspendLayout();
//
// toolBar
//
this.toolBar.Buttons.AddRange(new ToolBarButton[] {
this.tbtnScaleUp,
this.tbtnScaleDown
});
this.toolBar.DropDownArrows = true;
this.toolBar.ImageList = this.imageList;
this.toolBar.Location = new Point(0, 0);
this.toolBar.Name = "toolBar";
this.toolBar.ShowToolTips = true;
this.toolBar.Size = new Size(56, 30);
this.toolBar.TabIndex = 0;
this.toolBar.ButtonClick += new ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
//
// tbtnScaleUp
//
this.tbtnScaleUp.ImageIndex = 0;
this.tbtnScaleUp.Tag = "ScaleUp";
this.tbtnScaleUp.ToolTipText = "Scale up";
//
// tbtnScaleDown
//
this.tbtnScaleDown.ImageIndex = 1;
this.tbtnScaleDown.Tag = "ScaleDown";
this.tbtnScaleDown.ToolTipText = "Scale down";
//
// imageList
//
this.imageList.ImageSize = new Size(19, 18);
this.imageList.ImageStream = ((ImageListStreamer) (resources.GetObject("imageList.ImageStream")));
this.imageList.TransparentColor = Color.Transparent;
//
// ScalerToolBarControl
//
this.Controls.Add(this.toolBar);
this.Name = "ScalerToolBarControl";
this.Size = new Size(56, 32);
this.ResumeLayout(false);
}