<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FGUI_Windows_Form%2FToolBar</id>
		<title>Csharp/C Sharp/GUI Windows Form/ToolBar - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FGUI_Windows_Form%2FToolBar"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/ToolBar&amp;action=history"/>
		<updated>2026-04-29T17:16:00Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/ToolBar&amp;diff=158&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/ToolBar&amp;diff=158&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/ToolBar&amp;diff=159&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/ToolBar&amp;diff=159&amp;oldid=prev"/>
				<updated>2010-05-26T11:33:40Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Floating Toolbar==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
User Interfaces in C#: Windows Forms and Custom Controls&lt;br /&gt;
by Matthew MacDonald&lt;br /&gt;
Publisher: Apress&lt;br /&gt;
ISBN: 1590590457&lt;br /&gt;
*/&lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Data;&lt;br /&gt;
namespace FloatingToolbar&lt;br /&gt;
{&lt;br /&gt;
  /// &amp;lt;summary&amp;gt;&lt;br /&gt;
  /// Summary description for FloatingToolbar.&lt;br /&gt;
  /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
  public class FloatingToolbar : System.Windows.Forms.Form&lt;br /&gt;
  {&lt;br /&gt;
    internal System.Windows.Forms.ImageList imgButtons;&lt;br /&gt;
    internal System.Windows.Forms.ToolBar toolBar1;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton cmdNew;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton cmdOpen;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton cmdClose;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton cmdSave;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton1;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton cmdPreview;&lt;br /&gt;
    private System.ruponentModel.IContainer components;&lt;br /&gt;
    public FloatingToolbar()&lt;br /&gt;
    {&lt;br /&gt;
      //&lt;br /&gt;
      // Required for Windows Form Designer support&lt;br /&gt;
      //&lt;br /&gt;
      InitializeComponent();&lt;br /&gt;
      //&lt;br /&gt;
      // TODO: Add any constructor code after InitializeComponent call&lt;br /&gt;
      //&lt;br /&gt;
    }&lt;br /&gt;
    /// &amp;lt;summary&amp;gt;&lt;br /&gt;
    /// Clean up any resources being used.&lt;br /&gt;
    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    protected override void Dispose( bool disposing )&lt;br /&gt;
    {&lt;br /&gt;
      if( disposing )&lt;br /&gt;
      {&lt;br /&gt;
        if (components != null) &lt;br /&gt;
        {&lt;br /&gt;
          components.Dispose();&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      base.Dispose( disposing );&lt;br /&gt;
    }&lt;br /&gt;
    #region Windows Form Designer generated code&lt;br /&gt;
    /// &amp;lt;summary&amp;gt;&lt;br /&gt;
    /// Required method for Designer support - do not modify&lt;br /&gt;
    /// the contents of this method with the code editor.&lt;br /&gt;
    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    private void InitializeComponent()&lt;br /&gt;
    {&lt;br /&gt;
      this.ruponents = new System.ruponentModel.Container();&lt;br /&gt;
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FloatingToolbar));&lt;br /&gt;
      this.imgButtons = new System.Windows.Forms.ImageList(this.ruponents);&lt;br /&gt;
      this.toolBar1 = new System.Windows.Forms.ToolBar();&lt;br /&gt;
      this.cmdNew = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.cmdOpen = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.cmdClose = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.cmdSave = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton1 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.cmdPreview = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.SuspendLayout();&lt;br /&gt;
      // &lt;br /&gt;
      // imgButtons&lt;br /&gt;
      // &lt;br /&gt;
      this.imgButtons.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;&lt;br /&gt;
      this.imgButtons.ImageSize = new System.Drawing.Size(16, 16);&lt;br /&gt;
      this.imgButtons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject(&amp;quot;imgButtons.ImageStream&amp;quot;)));&lt;br /&gt;
      this.imgButtons.TransparentColor = System.Drawing.Color.Transparent;&lt;br /&gt;
      // &lt;br /&gt;
      // toolBar1&lt;br /&gt;
      // &lt;br /&gt;
      this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;&lt;br /&gt;
      this.toolBar1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;&lt;br /&gt;
      this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {&lt;br /&gt;
                                            this.cmdNew,&lt;br /&gt;
                                            this.cmdOpen,&lt;br /&gt;
                                            this.cmdClose,&lt;br /&gt;
                                            this.cmdSave,&lt;br /&gt;
                                            this.ToolBarButton1,&lt;br /&gt;
                                            this.cmdPreview});&lt;br /&gt;
      this.toolBar1.DropDownArrows = true;&lt;br /&gt;
      this.toolBar1.ImageList = this.imgButtons;&lt;br /&gt;
      this.toolBar1.Name = &amp;quot;toolBar1&amp;quot;;&lt;br /&gt;
      this.toolBar1.ShowToolTips = true;&lt;br /&gt;
      this.toolBar1.Size = new System.Drawing.Size(292, 41);&lt;br /&gt;
      this.toolBar1.TabIndex = 5;&lt;br /&gt;
      this.toolBar1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.toolBar1_MouseUp);&lt;br /&gt;
      this.toolBar1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.toolBar1_MouseMove);&lt;br /&gt;
      this.toolBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.toolBar1_MouseDown);&lt;br /&gt;
      // &lt;br /&gt;
      // cmdNew&lt;br /&gt;
      // &lt;br /&gt;
      this.cmdNew.ImageIndex = 3;&lt;br /&gt;
      this.cmdNew.Text = &amp;quot;New&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // cmdOpen&lt;br /&gt;
      // &lt;br /&gt;
      this.cmdOpen.ImageIndex = 0;&lt;br /&gt;
      this.cmdOpen.Text = &amp;quot;Open&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // cmdClose&lt;br /&gt;
      // &lt;br /&gt;
      this.cmdClose.ImageIndex = 1;&lt;br /&gt;
      this.cmdClose.Text = &amp;quot;Close&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // cmdSave&lt;br /&gt;
      // &lt;br /&gt;
      this.cmdSave.ImageIndex = 2;&lt;br /&gt;
      this.cmdSave.Text = &amp;quot;Save&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton1&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;&lt;br /&gt;
      // &lt;br /&gt;
      // cmdPreview&lt;br /&gt;
      // &lt;br /&gt;
      this.cmdPreview.ImageIndex = 4;&lt;br /&gt;
      this.cmdPreview.Text = &amp;quot;Preview&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // FloatingToolbar&lt;br /&gt;
      // &lt;br /&gt;
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
      this.ClientSize = new System.Drawing.Size(292, 266);&lt;br /&gt;
      this.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                      this.toolBar1});&lt;br /&gt;
      this.IsMdiContainer = true;&lt;br /&gt;
      this.Name = &amp;quot;FloatingToolbar&amp;quot;;&lt;br /&gt;
      this.Text = &amp;quot;Floating Toolbar&amp;quot;;&lt;br /&gt;
      this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
    #endregion&lt;br /&gt;
    /// &amp;lt;summary&amp;gt;&lt;br /&gt;
    /// The main entry point for the application.&lt;br /&gt;
    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main() &lt;br /&gt;
    {&lt;br /&gt;
      Application.Run(new FloatingToolbar());&lt;br /&gt;
    }&lt;br /&gt;
    private bool draggingToolbar;&lt;br /&gt;
    private Point draggedFrom;&lt;br /&gt;
&lt;br /&gt;
    private void toolBar1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      if (draggingToolbar)&lt;br /&gt;
      {&lt;br /&gt;
        //if (toolBar1.Dock == DockStyle.Top || toolBar1.Dock == DockStyle.Left) &lt;br /&gt;
        if (toolBar1.Dock == DockStyle.Top)&lt;br /&gt;
        {&lt;br /&gt;
          // Check it the dragging has reached the threshold.&lt;br /&gt;
          if (draggedFrom.X &amp;lt; (e.X - 20) || draggedFrom.Y &amp;lt; (e.Y - 20))&lt;br /&gt;
          {&lt;br /&gt;
            draggingToolbar = false;&lt;br /&gt;
            &lt;br /&gt;
            // Disconnect the toolbar.&lt;br /&gt;
            toolBar1.Dock = DockStyle.None;&lt;br /&gt;
            toolBar1.Location = new Point(10, 10);&lt;br /&gt;
            toolBar1.Size = new Size(200, 100);&lt;br /&gt;
            toolBar1.BorderStyle = BorderStyle.FixedSingle;&lt;br /&gt;
          }&lt;br /&gt;
        }&lt;br /&gt;
        else if (toolBar1.Dock == DockStyle.None)&lt;br /&gt;
        {&lt;br /&gt;
          toolBar1.Left = e.X + toolBar1.Left - draggedFrom.X;&lt;br /&gt;
          toolBar1.Top = e.Y + toolBar1.Top - draggedFrom.Y;&lt;br /&gt;
          &lt;br /&gt;
          if (toolBar1.Top &amp;lt; 5)&lt;br /&gt;
          {&lt;br /&gt;
            draggingToolbar = false;&lt;br /&gt;
            &lt;br /&gt;
            // Re-dock the control.&lt;br /&gt;
            toolBar1.Dock = DockStyle.Top;&lt;br /&gt;
            toolBar1.BorderStyle = BorderStyle.None;&lt;br /&gt;
          }&lt;br /&gt;
          else if (toolBar1.Left &amp;lt; 5)&lt;br /&gt;
          {&lt;br /&gt;
            draggingToolbar = false;&lt;br /&gt;
            &lt;br /&gt;
            // Re-dock the control.&lt;br /&gt;
            toolBar1.Dock = DockStyle.Left;&lt;br /&gt;
            toolBar1.BorderStyle = BorderStyle.None;&lt;br /&gt;
          }&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    private void toolBar1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      draggingToolbar = true;&lt;br /&gt;
      draggedFrom = new Point(e.X, e.Y);&lt;br /&gt;
      toolBar1.Capture = true;&lt;br /&gt;
    }&lt;br /&gt;
    private void toolBar1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      draggingToolbar = false;&lt;br /&gt;
      toolBar1.Capture = false;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;A href=&amp;quot;http://www.nfex.ru/Code/CSharpDownload/FloatingToolbar.zip&amp;quot;&amp;gt;FloatingToolbar.zip( 30 k)&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ImageList for ToolBar==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class SimpleToolBar: Form&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new SimpleToolBar());&lt;br /&gt;
     }&lt;br /&gt;
     public SimpleToolBar()&lt;br /&gt;
     {&lt;br /&gt;
          Menu = new MainMenu();&lt;br /&gt;
          Menu.MenuItems.Add(&amp;quot;File&amp;quot;);&lt;br /&gt;
          Menu.MenuItems.Add(&amp;quot;Edit&amp;quot;);&lt;br /&gt;
          Menu.MenuItems.Add(&amp;quot;View&amp;quot;);&lt;br /&gt;
          Menu.MenuItems.Add(&amp;quot;Help&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
          Bitmap bm = new Bitmap(GetType(),&amp;quot;SimpleToolBar.bmp&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
          ImageList imglst = new ImageList();&lt;br /&gt;
          imglst.Images.AddStrip(bm);&lt;br /&gt;
          imglst.TransparentColor = Color.Cyan;&lt;br /&gt;
   &lt;br /&gt;
          ToolBar tbar = new ToolBar();&lt;br /&gt;
          tbar.Parent = this;&lt;br /&gt;
          tbar.ImageList = imglst;&lt;br /&gt;
          tbar.ShowToolTips = true;&lt;br /&gt;
   &lt;br /&gt;
          string[] astr = {&amp;quot;New&amp;quot;, &amp;quot;Open&amp;quot;, &amp;quot;Save&amp;quot;, &amp;quot;Print&amp;quot;, &amp;quot;Cut&amp;quot;, &amp;quot;Copy&amp;quot;, &amp;quot;Paste&amp;quot; };&lt;br /&gt;
   &lt;br /&gt;
          for (int i = 0; i &amp;lt; 7; i++)&lt;br /&gt;
          {&lt;br /&gt;
               ToolBarButton tbarbtn = new ToolBarButton();&lt;br /&gt;
               tbarbtn.ImageIndex = i;&lt;br /&gt;
               tbarbtn.ToolTipText = astr[i];&lt;br /&gt;
   &lt;br /&gt;
               tbar.Buttons.Add(tbarbtn);&lt;br /&gt;
          }&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ToolBar Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
User Interfaces in C#: Windows Forms and Custom Controls&lt;br /&gt;
by Matthew MacDonald&lt;br /&gt;
Publisher: Apress&lt;br /&gt;
ISBN: 1590590457&lt;br /&gt;
*/&lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Data;&lt;br /&gt;
  /// &amp;lt;summary&amp;gt;&lt;br /&gt;
  /// Summary description for ToolBarExample.&lt;br /&gt;
  /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
  public class ToolBarExample : System.Windows.Forms.Form&lt;br /&gt;
  {&lt;br /&gt;
    internal System.Windows.Forms.ContextMenu ContextMenu1;&lt;br /&gt;
    internal System.Windows.Forms.MenuItem MenuItem1;&lt;br /&gt;
    internal System.Windows.Forms.MenuItem MenuItem2;&lt;br /&gt;
    internal System.Windows.Forms.MenuItem MenuItem3;&lt;br /&gt;
    internal System.Windows.Forms.ImageList imagesToolBar;&lt;br /&gt;
    internal System.Windows.Forms.ImageList imagesLarge;&lt;br /&gt;
    internal System.Windows.Forms.ToolBar ToolBar4;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton13;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton16;&lt;br /&gt;
    internal System.Windows.Forms.ToolBar ToolBar3;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton8;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton9;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton12;&lt;br /&gt;
    internal System.Windows.Forms.ToolBar ToolBar2;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton4;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton5;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton6;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton7;&lt;br /&gt;
    internal System.Windows.Forms.ToolBar ToolBar1;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton1;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton2;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton3;&lt;br /&gt;
    internal System.Windows.Forms.ToolBarButton ToolBarButton10;&lt;br /&gt;
    internal System.Windows.Forms.Label Label4;&lt;br /&gt;
    internal System.Windows.Forms.Label Label3;&lt;br /&gt;
    internal System.Windows.Forms.Label Label2;&lt;br /&gt;
    internal System.Windows.Forms.Label Label1;&lt;br /&gt;
    private System.ruponentModel.IContainer components;&lt;br /&gt;
    public ToolBarExample()&lt;br /&gt;
    {&lt;br /&gt;
      //&lt;br /&gt;
      // Required for Windows Form Designer support&lt;br /&gt;
      //&lt;br /&gt;
      InitializeComponent();&lt;br /&gt;
      //&lt;br /&gt;
      // TODO: Add any constructor code after InitializeComponent call&lt;br /&gt;
      //&lt;br /&gt;
    }&lt;br /&gt;
    /// &amp;lt;summary&amp;gt;&lt;br /&gt;
    /// Clean up any resources being used.&lt;br /&gt;
    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    protected override void Dispose( bool disposing )&lt;br /&gt;
    {&lt;br /&gt;
      if( disposing )&lt;br /&gt;
      {&lt;br /&gt;
        if (components != null) &lt;br /&gt;
        {&lt;br /&gt;
          components.Dispose();&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      base.Dispose( disposing );&lt;br /&gt;
    }&lt;br /&gt;
    #region Windows Form Designer generated code&lt;br /&gt;
    /// &amp;lt;summary&amp;gt;&lt;br /&gt;
    /// Required method for Designer support - do not modify&lt;br /&gt;
    /// the contents of this method with the code editor.&lt;br /&gt;
    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    private void InitializeComponent()&lt;br /&gt;
    {&lt;br /&gt;
      this.ruponents = new System.ruponentModel.Container();&lt;br /&gt;
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ToolBarExample));&lt;br /&gt;
      this.ContextMenu1 = new System.Windows.Forms.ContextMenu();&lt;br /&gt;
      this.MenuItem1 = new System.Windows.Forms.MenuItem();&lt;br /&gt;
      this.MenuItem2 = new System.Windows.Forms.MenuItem();&lt;br /&gt;
      this.MenuItem3 = new System.Windows.Forms.MenuItem();&lt;br /&gt;
      this.imagesToolBar = new System.Windows.Forms.ImageList(this.ruponents);&lt;br /&gt;
      this.imagesLarge = new System.Windows.Forms.ImageList(this.ruponents);&lt;br /&gt;
      this.ToolBar4 = new System.Windows.Forms.ToolBar();&lt;br /&gt;
      this.ToolBarButton13 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton16 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBar3 = new System.Windows.Forms.ToolBar();&lt;br /&gt;
      this.ToolBarButton8 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton9 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton12 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBar2 = new System.Windows.Forms.ToolBar();&lt;br /&gt;
      this.ToolBarButton4 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton5 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton6 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton7 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBar1 = new System.Windows.Forms.ToolBar();&lt;br /&gt;
      this.ToolBarButton1 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton2 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton3 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.ToolBarButton10 = new System.Windows.Forms.ToolBarButton();&lt;br /&gt;
      this.Label4 = new System.Windows.Forms.Label();&lt;br /&gt;
      this.Label3 = new System.Windows.Forms.Label();&lt;br /&gt;
      this.Label2 = new System.Windows.Forms.Label();&lt;br /&gt;
      this.Label1 = new System.Windows.Forms.Label();&lt;br /&gt;
      this.SuspendLayout();&lt;br /&gt;
      // &lt;br /&gt;
      // ContextMenu1&lt;br /&gt;
      // &lt;br /&gt;
      this.ContextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {&lt;br /&gt;
                                             this.MenuItem1,&lt;br /&gt;
                                             this.MenuItem2,&lt;br /&gt;
                                             this.MenuItem3});&lt;br /&gt;
      // &lt;br /&gt;
      // MenuItem1&lt;br /&gt;
      // &lt;br /&gt;
      this.MenuItem1.Index = 0;&lt;br /&gt;
      this.MenuItem1.Text = &amp;quot;Menu 1&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // MenuItem2&lt;br /&gt;
      // &lt;br /&gt;
      this.MenuItem2.Index = 1;&lt;br /&gt;
      this.MenuItem2.Text = &amp;quot;Menu 2&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // MenuItem3&lt;br /&gt;
      // &lt;br /&gt;
      this.MenuItem3.Index = 2;&lt;br /&gt;
      this.MenuItem3.Text = &amp;quot;Menu 3&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // imagesToolBar&lt;br /&gt;
      // &lt;br /&gt;
      this.imagesToolBar.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;&lt;br /&gt;
      this.imagesToolBar.ImageSize = new System.Drawing.Size(16, 16);&lt;br /&gt;
      this.imagesToolBar.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject(&amp;quot;imagesToolBar.ImageStream&amp;quot;)));&lt;br /&gt;
      this.imagesToolBar.TransparentColor = System.Drawing.Color.Transparent;&lt;br /&gt;
      // &lt;br /&gt;
      // imagesLarge&lt;br /&gt;
      // &lt;br /&gt;
      this.imagesLarge.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;&lt;br /&gt;
      this.imagesLarge.ImageSize = new System.Drawing.Size(32, 32);&lt;br /&gt;
      this.imagesLarge.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject(&amp;quot;imagesLarge.ImageStream&amp;quot;)));&lt;br /&gt;
      this.imagesLarge.TransparentColor = System.Drawing.Color.Transparent;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBar4&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBar4.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;&lt;br /&gt;
      this.ToolBar4.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {&lt;br /&gt;
                                            this.ToolBarButton13,&lt;br /&gt;
                                            this.ToolBarButton16});&lt;br /&gt;
      this.ToolBar4.DropDownArrows = true;&lt;br /&gt;
      this.ToolBar4.ImageList = this.imagesToolBar;&lt;br /&gt;
      this.ToolBar4.Location = new System.Drawing.Point(0, 89);&lt;br /&gt;
      this.ToolBar4.Name = &amp;quot;ToolBar4&amp;quot;;&lt;br /&gt;
      this.ToolBar4.ShowToolTips = true;&lt;br /&gt;
      this.ToolBar4.Size = new System.Drawing.Size(344, 25);&lt;br /&gt;
      this.ToolBar4.TabIndex = 9;&lt;br /&gt;
      this.ToolBar4.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton13&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton13.DropDownMenu = this.ContextMenu1;&lt;br /&gt;
      this.ToolBarButton13.ImageIndex = 0;&lt;br /&gt;
      this.ToolBarButton13.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;&lt;br /&gt;
      this.ToolBarButton13.Text = &amp;quot;One&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton16&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton16.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBar3&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBar3.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;&lt;br /&gt;
      this.ToolBar3.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {&lt;br /&gt;
                                            this.ToolBarButton8,&lt;br /&gt;
                                            this.ToolBarButton9,&lt;br /&gt;
                                            this.ToolBarButton12});&lt;br /&gt;
      this.ToolBar3.DropDownArrows = true;&lt;br /&gt;
      this.ToolBar3.ImageList = this.imagesToolBar;&lt;br /&gt;
      this.ToolBar3.Location = new System.Drawing.Point(0, 64);&lt;br /&gt;
      this.ToolBar3.Name = &amp;quot;ToolBar3&amp;quot;;&lt;br /&gt;
      this.ToolBar3.ShowToolTips = true;&lt;br /&gt;
      this.ToolBar3.Size = new System.Drawing.Size(344, 25);&lt;br /&gt;
      this.ToolBar3.TabIndex = 8;&lt;br /&gt;
      this.ToolBar3.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton8&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton8.ImageIndex = 0;&lt;br /&gt;
      this.ToolBarButton8.Pushed = true;&lt;br /&gt;
      this.ToolBarButton8.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;&lt;br /&gt;
      this.ToolBarButton8.Text = &amp;quot;One&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton9&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton9.ImageIndex = 1;&lt;br /&gt;
      this.ToolBarButton9.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;&lt;br /&gt;
      this.ToolBarButton9.Text = &amp;quot;Two&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton12&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton12.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBar2&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBar2.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;&lt;br /&gt;
      this.ToolBar2.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {&lt;br /&gt;
                                            this.ToolBarButton4,&lt;br /&gt;
                                            this.ToolBarButton5,&lt;br /&gt;
                                            this.ToolBarButton6,&lt;br /&gt;
                                            this.ToolBarButton7});&lt;br /&gt;
      this.ToolBar2.DropDownArrows = true;&lt;br /&gt;
      this.ToolBar2.ImageList = this.imagesToolBar;&lt;br /&gt;
      this.ToolBar2.Location = new System.Drawing.Point(0, 39);&lt;br /&gt;
      this.ToolBar2.Name = &amp;quot;ToolBar2&amp;quot;;&lt;br /&gt;
      this.ToolBar2.ShowToolTips = true;&lt;br /&gt;
      this.ToolBar2.Size = new System.Drawing.Size(344, 25);&lt;br /&gt;
      this.ToolBar2.TabIndex = 7;&lt;br /&gt;
      this.ToolBar2.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton4&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton4.ImageIndex = 0;&lt;br /&gt;
      this.ToolBarButton4.Text = &amp;quot;One&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton5&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton5.ImageIndex = 1;&lt;br /&gt;
      this.ToolBarButton5.Text = &amp;quot;Two&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton6&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton6.ImageIndex = 2;&lt;br /&gt;
      this.ToolBarButton6.Text = &amp;quot;Three&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton7&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton7.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBar1&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;&lt;br /&gt;
      this.ToolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {&lt;br /&gt;
                                            this.ToolBarButton1,&lt;br /&gt;
                                            this.ToolBarButton2,&lt;br /&gt;
                                            this.ToolBarButton3,&lt;br /&gt;
                                            this.ToolBarButton10});&lt;br /&gt;
      this.ToolBar1.DropDownArrows = true;&lt;br /&gt;
      this.ToolBar1.ImageList = this.imagesToolBar;&lt;br /&gt;
      this.ToolBar1.Name = &amp;quot;ToolBar1&amp;quot;;&lt;br /&gt;
      this.ToolBar1.ShowToolTips = true;&lt;br /&gt;
      this.ToolBar1.Size = new System.Drawing.Size(344, 39);&lt;br /&gt;
      this.ToolBar1.TabIndex = 6;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton1&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton1.ImageIndex = 0;&lt;br /&gt;
      this.ToolBarButton1.Text = &amp;quot;One&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton2&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton2.ImageIndex = 1;&lt;br /&gt;
      this.ToolBarButton2.Text = &amp;quot;Two&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton3&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton3.ImageIndex = 2;&lt;br /&gt;
      this.ToolBarButton3.Text = &amp;quot;Three&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarButton10&lt;br /&gt;
      // &lt;br /&gt;
      this.ToolBarButton10.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;&lt;br /&gt;
      // &lt;br /&gt;
      // Label4&lt;br /&gt;
      // &lt;br /&gt;
      this.Label4.ForeColor = System.Drawing.Color.Navy;&lt;br /&gt;
      this.Label4.Location = new System.Drawing.Point(104, 92);&lt;br /&gt;
      this.Label4.Name = &amp;quot;Label4&amp;quot;;&lt;br /&gt;
      this.Label4.Size = new System.Drawing.Size(112, 16);&lt;br /&gt;
      this.Label4.TabIndex = 13;&lt;br /&gt;
      this.Label4.Text = &amp;quot;Drop-Down Button&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // Label3&lt;br /&gt;
      // &lt;br /&gt;
      this.Label3.ForeColor = System.Drawing.Color.Navy;&lt;br /&gt;
      this.Label3.Location = new System.Drawing.Point(136, 68);&lt;br /&gt;
      this.Label3.Name = &amp;quot;Label3&amp;quot;;&lt;br /&gt;
      this.Label3.Size = new System.Drawing.Size(88, 16);&lt;br /&gt;
      this.Label3.TabIndex = 12;&lt;br /&gt;
      this.Label3.Text = &amp;quot;Toggle Buttons&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // Label2&lt;br /&gt;
      // &lt;br /&gt;
      this.Label2.ForeColor = System.Drawing.Color.Navy;&lt;br /&gt;
      this.Label2.Location = new System.Drawing.Point(192, 40);&lt;br /&gt;
      this.Label2.Name = &amp;quot;Label2&amp;quot;;&lt;br /&gt;
      this.Label2.Size = new System.Drawing.Size(72, 16);&lt;br /&gt;
      this.Label2.TabIndex = 11;&lt;br /&gt;
      this.Label2.Text = &amp;quot;Text on Right&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // Label1&lt;br /&gt;
      // &lt;br /&gt;
      this.Label1.ForeColor = System.Drawing.Color.Navy;&lt;br /&gt;
      this.Label1.Location = new System.Drawing.Point(128, 12);&lt;br /&gt;
      this.Label1.Name = &amp;quot;Label1&amp;quot;;&lt;br /&gt;
      this.Label1.Size = new System.Drawing.Size(64, 16);&lt;br /&gt;
      this.Label1.TabIndex = 10;&lt;br /&gt;
      this.Label1.Text = &amp;quot;Flat Buttons&amp;quot;;&lt;br /&gt;
      // &lt;br /&gt;
      // ToolBarExample&lt;br /&gt;
      // &lt;br /&gt;
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);&lt;br /&gt;
      this.ClientSize = new System.Drawing.Size(344, 266);&lt;br /&gt;
      this.Controls.AddRange(new System.Windows.Forms.Control[] {&lt;br /&gt;
                                      this.Label4,&lt;br /&gt;
                                      this.Label3,&lt;br /&gt;
                                      this.Label2,&lt;br /&gt;
                                      this.Label1,&lt;br /&gt;
                                      this.ToolBar4,&lt;br /&gt;
                                      this.ToolBar3,&lt;br /&gt;
                                      this.ToolBar2,&lt;br /&gt;
                                      this.ToolBar1});&lt;br /&gt;
      this.Font = new System.Drawing.Font(&amp;quot;Tahoma&amp;quot;, 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));&lt;br /&gt;
      this.Name = &amp;quot;ToolBarExample&amp;quot;;&lt;br /&gt;
      this.Text = &amp;quot;ToolBarExample&amp;quot;;&lt;br /&gt;
      this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
    #endregion&lt;br /&gt;
    /// &amp;lt;summary&amp;gt;&lt;br /&gt;
    /// The main entry point for the application.&lt;br /&gt;
    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main() &lt;br /&gt;
    {&lt;br /&gt;
      Application.Run(new ToolBarExample());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;A href=&amp;quot;http://www.nfex.ru/Code/CSharpDownload/ToolBarExample.zip&amp;quot;&amp;gt;ToolBarExample.zip( 17 k)&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ToolBar float window==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
public class Palette : Form&lt;br /&gt;
{&lt;br /&gt;
  private System.Windows.Forms.Label lblPictureThree;&lt;br /&gt;
  private System.Windows.Forms.Label lblPictureTwo;&lt;br /&gt;
  private System.Windows.Forms.Label lblPictureOne;&lt;br /&gt;
  public Palette() {&lt;br /&gt;
        InitializeComponent();&lt;br /&gt;
  }&lt;br /&gt;
  private void lbl_MouseDown(object sender, MouseEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    Label lbl = (Label)sender;&lt;br /&gt;
    lbl.DoDragDrop(lbl.Image, DragDropEffects.Copy);&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.lblPictureThree = new System.Windows.Forms.Label();&lt;br /&gt;
    this.lblPictureTwo = new System.Windows.Forms.Label();&lt;br /&gt;
    this.lblPictureOne = new System.Windows.Forms.Label();&lt;br /&gt;
    this.SuspendLayout();&lt;br /&gt;
    // &lt;br /&gt;
    // lblPictureThree&lt;br /&gt;
    // &lt;br /&gt;
    this.lblPictureThree.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;&lt;br /&gt;
    this.lblPictureThree.Image = new Bitmap(&amp;quot;winter.jpg&amp;quot;);&lt;br /&gt;
    this.lblPictureThree.Location = new System.Drawing.Point(12, 113);&lt;br /&gt;
    this.lblPictureThree.Name = &amp;quot;lblPictureThree&amp;quot;;&lt;br /&gt;
    this.lblPictureThree.Size = new System.Drawing.Size(56, 48);&lt;br /&gt;
    this.lblPictureThree.TabIndex = 6;&lt;br /&gt;
    this.lblPictureThree.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown);&lt;br /&gt;
    // &lt;br /&gt;
    // lblPictureTwo&lt;br /&gt;
    // &lt;br /&gt;
    this.lblPictureTwo.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;&lt;br /&gt;
    this.lblPictureTwo.Image = new Bitmap(&amp;quot;winter.jpg&amp;quot;);&lt;br /&gt;
    this.lblPictureTwo.Location = new System.Drawing.Point(12, 61);&lt;br /&gt;
    this.lblPictureTwo.Name = &amp;quot;lblPictureTwo&amp;quot;;&lt;br /&gt;
    this.lblPictureTwo.Size = new System.Drawing.Size(56, 48);&lt;br /&gt;
    this.lblPictureTwo.TabIndex = 5;&lt;br /&gt;
    this.lblPictureTwo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown);&lt;br /&gt;
    // &lt;br /&gt;
    // lblPictureOne&lt;br /&gt;
    // &lt;br /&gt;
    this.lblPictureOne.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;&lt;br /&gt;
    this.lblPictureOne.Image = new Bitmap(&amp;quot;winter.jpg&amp;quot;);&lt;br /&gt;
    this.lblPictureOne.Location = new System.Drawing.Point(12, 9);&lt;br /&gt;
    this.lblPictureOne.Name = &amp;quot;lblPictureOne&amp;quot;;&lt;br /&gt;
    this.lblPictureOne.Size = new System.Drawing.Size(56, 48);&lt;br /&gt;
    this.lblPictureOne.TabIndex = 4;&lt;br /&gt;
    this.lblPictureOne.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown);&lt;br /&gt;
    // &lt;br /&gt;
    // Palette&lt;br /&gt;
    // &lt;br /&gt;
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(83, 173);&lt;br /&gt;
    this.Controls.Add(this.lblPictureTwo);&lt;br /&gt;
    this.Controls.Add(this.lblPictureOne);&lt;br /&gt;
    this.Controls.Add(this.lblPictureThree);&lt;br /&gt;
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;&lt;br /&gt;
    this.Name = &amp;quot;Palette&amp;quot;;&lt;br /&gt;
    this.ShowInTaskbar = false;&lt;br /&gt;
    this.Text = &amp;quot;Palette&amp;quot;;&lt;br /&gt;
    this.ResumeLayout(false);&lt;br /&gt;
  }&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    Application.Run(new DrawingArea());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
  public class DrawingArea : Form&lt;br /&gt;
  {&lt;br /&gt;
    private System.Windows.Forms.PictureBox picDrawingArea;&lt;br /&gt;
    public DrawingArea()&lt;br /&gt;
    {&lt;br /&gt;
      InitializeComponent();&lt;br /&gt;
    }&lt;br /&gt;
    private void DrawingArea_Load(object sender, EventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      Palette frmTool = new Palette();&lt;br /&gt;
      this.AddOwnedForm(frmTool);&lt;br /&gt;
      frmTool.Show();&lt;br /&gt;
      picDrawingArea.AllowDrop = true;&lt;br /&gt;
    }&lt;br /&gt;
    private void picDrawingArea_DragEnter(object sender, DragEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      if (e.Data.GetDataPresent(DataFormats.Bitmap))&lt;br /&gt;
      {&lt;br /&gt;
        e.Effect = DragDropEffects.Copy;&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
        e.Effect = DragDropEffects.None;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    private void picDrawingArea_DragDrop(object sender, DragEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      Graphics g = picDrawingArea.CreateGraphics();&lt;br /&gt;
      g.DrawImage((Image)e.Data.GetData(DataFormats.Bitmap),&lt;br /&gt;
        new Point(e.X - this.Left, e.Y - this.Top));&lt;br /&gt;
    }&lt;br /&gt;
     private void InitializeComponent()&lt;br /&gt;
    {&lt;br /&gt;
      this.picDrawingArea = new System.Windows.Forms.PictureBox();&lt;br /&gt;
      ((System.ruponentModel.ISupportInitialize)(this.picDrawingArea)).BeginInit();&lt;br /&gt;
      this.SuspendLayout();&lt;br /&gt;
      // &lt;br /&gt;
      // picDrawingArea&lt;br /&gt;
      // &lt;br /&gt;
      this.picDrawingArea.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)&lt;br /&gt;
            | System.Windows.Forms.AnchorStyles.Left)&lt;br /&gt;
            | System.Windows.Forms.AnchorStyles.Right)));&lt;br /&gt;
      this.picDrawingArea.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;&lt;br /&gt;
      this.picDrawingArea.Location = new System.Drawing.Point(1, 2);&lt;br /&gt;
      this.picDrawingArea.Name = &amp;quot;picDrawingArea&amp;quot;;&lt;br /&gt;
      this.picDrawingArea.Size = new System.Drawing.Size(377, 270);&lt;br /&gt;
      this.picDrawingArea.TabIndex = 2;&lt;br /&gt;
      this.picDrawingArea.TabStop = false;&lt;br /&gt;
      this.picDrawingArea.DragDrop += new System.Windows.Forms.DragEventHandler(this.picDrawingArea_DragDrop);&lt;br /&gt;
      this.picDrawingArea.DragEnter += new System.Windows.Forms.DragEventHandler(this.picDrawingArea_DragEnter);&lt;br /&gt;
      // &lt;br /&gt;
      // DrawingArea&lt;br /&gt;
      // &lt;br /&gt;
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
      this.ClientSize = new System.Drawing.Size(379, 274);&lt;br /&gt;
      this.Controls.Add(this.picDrawingArea);&lt;br /&gt;
      this.Name = &amp;quot;DrawingArea&amp;quot;;&lt;br /&gt;
      this.Text = &amp;quot;Drawing Area&amp;quot;;&lt;br /&gt;
      this.Load += new System.EventHandler(this.DrawingArea_Load);&lt;br /&gt;
      ((System.ruponentModel.ISupportInitialize)(this.picDrawingArea)).EndInit();&lt;br /&gt;
      this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using ToolBarButton==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class ToggleButtons: Form&lt;br /&gt;
{&lt;br /&gt;
     protected Panel   panel = new Panel();&lt;br /&gt;
     protected ToolBar tbar;&lt;br /&gt;
     protected string  strText = &amp;quot;Toggle&amp;quot;;&lt;br /&gt;
     protected Color   clrText = SystemColors.WindowText;&lt;br /&gt;
     FontStyle         fontstyle = FontStyle.Regular;&lt;br /&gt;
   &lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new ToggleButtons());&lt;br /&gt;
     }&lt;br /&gt;
     public ToggleButtons()&lt;br /&gt;
     {&lt;br /&gt;
          panel.Parent = this;&lt;br /&gt;
          panel.Dock = DockStyle.Fill;&lt;br /&gt;
          panel.BackColor = SystemColors.Window;&lt;br /&gt;
          panel.ForeColor = SystemColors.WindowText;&lt;br /&gt;
          panel.Resize += new EventHandler(PanelOnResize);&lt;br /&gt;
          panel.Paint += new PaintEventHandler(PanelOnPaint);&lt;br /&gt;
   &lt;br /&gt;
          Bitmap bm = new Bitmap(GetType(), &amp;quot;ToggleButtons.bmp&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
          ImageList imglst = new ImageList();&lt;br /&gt;
          imglst.ImageSize = new Size(bm.Width / 4, bm.Height);&lt;br /&gt;
          imglst.Images.AddStrip(bm);&lt;br /&gt;
          imglst.TransparentColor = Color.White;&lt;br /&gt;
   &lt;br /&gt;
          tbar = new ToolBar();&lt;br /&gt;
          tbar.ImageList = imglst;&lt;br /&gt;
          tbar.Parent = this;&lt;br /&gt;
          tbar.ShowToolTips = true;&lt;br /&gt;
          tbar.ButtonClick += new ToolBarButtonClickEventHandler(ToolBarOnClick);&lt;br /&gt;
   &lt;br /&gt;
          FontStyle[] afs = { FontStyle.Bold, FontStyle.Italic,&lt;br /&gt;
                              FontStyle.Underline, FontStyle.Strikeout };&lt;br /&gt;
   &lt;br /&gt;
          for (int i = 0; i &amp;lt; 4; i++)&lt;br /&gt;
          {&lt;br /&gt;
               ToolBarButton tbarbtn = new ToolBarButton();&lt;br /&gt;
               tbarbtn.ImageIndex = i;&lt;br /&gt;
               tbarbtn.Style = ToolBarButtonStyle.ToggleButton;&lt;br /&gt;
               tbarbtn.ToolTipText = afs[i].ToString();&lt;br /&gt;
               tbarbtn.Tag = afs[i];&lt;br /&gt;
   &lt;br /&gt;
               tbar.Buttons.Add(tbarbtn);&lt;br /&gt;
          }&lt;br /&gt;
     }&lt;br /&gt;
     void ToolBarOnClick(object obj, ToolBarButtonClickEventArgs tbbcea)&lt;br /&gt;
     {&lt;br /&gt;
          ToolBarButton tbarbtn = tbbcea.Button;&lt;br /&gt;
   &lt;br /&gt;
          if (tbarbtn.Tag == null ||&lt;br /&gt;
              tbarbtn.Tag.GetType() != typeof(FontStyle))&lt;br /&gt;
               return;&lt;br /&gt;
   &lt;br /&gt;
          if (tbarbtn.Pushed)&lt;br /&gt;
               fontstyle |= (FontStyle) tbarbtn.Tag;&lt;br /&gt;
          else&lt;br /&gt;
               fontstyle &amp;amp;= ~(FontStyle) tbarbtn.Tag;&lt;br /&gt;
   &lt;br /&gt;
          panel.Invalidate();&lt;br /&gt;
     }&lt;br /&gt;
     void PanelOnResize(object obj, EventArgs ea)&lt;br /&gt;
     {&lt;br /&gt;
          Panel panel = (Panel) obj;&lt;br /&gt;
          panel.Invalidate();&lt;br /&gt;
     }&lt;br /&gt;
     void PanelOnPaint(object obj, PaintEventArgs pea)&lt;br /&gt;
     {&lt;br /&gt;
          Panel    panel = (Panel) obj;&lt;br /&gt;
          Graphics grfx  = pea.Graphics;&lt;br /&gt;
          Font     font  = new Font(&amp;quot;Times New Roman&amp;quot;, 72, fontstyle);&lt;br /&gt;
          SizeF    sizef = grfx.MeasureString(strText, font);&lt;br /&gt;
   &lt;br /&gt;
          grfx.DrawString(strText, font, new SolidBrush(clrText),&lt;br /&gt;
                          (panel.Width - sizef.Width) / 2,&lt;br /&gt;
                          (panel.Height - sizef.Height) / 2);&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>