ImageList.Images.AddStrip
using System;
using System.Drawing;
using System.Windows.Forms;
class SimpleToolBar: Form
{
public static void Main()
{
Application.Run(new SimpleToolBar());
}
public SimpleToolBar()
{
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 imglst = new ImageList();
imglst.Images.AddStrip(bm);
imglst.TransparentColor = Color.Cyan;
ToolBar tbar = new ToolBar();
tbar.Parent = this;
tbar.ImageList = imglst;
tbar.ShowToolTips = true;
string[] astr = {"New", "Open", "Save", "Print", "Cut", "Copy", "Paste" };
for (int i = 0; i < 7; i++)
{
ToolBarButton tbarbtn = new ToolBarButton();
tbarbtn.ImageIndex = i;
tbarbtn.ToolTipText = astr[i];
tbar.Buttons.Add(tbarbtn);
}
}
}
Related examples in the same category