ImageList.Images.AddStrip : ImageList « System.Windows.Forms « C# / C Sharp by API






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

1.ImageList.ColorDepth
2.ImageList.ImageSize
3.ImageList.Images
4.ImageList.TransparentColor