title: How add my ImageButton to ToolStrip
body: <p>Create IMageButton and add to toolstrip:</p>
  
  <pre><code>ImageButton imageButton1 = new ImageButton();
  toolstrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
              imageButton1});
  </code></pre>
  
  <p>crash error </p>
  
  <blockquote>
    <p>Error 1   Cannot implicitly convert type
    'lient.userControl.ImageButton' to
    'System.Windows.Forms.ToolStripItem'  E:\net_project\trunk\Client\Client\userControl\ToolBox.cs   29  15  Client</p>
  </blockquote>
  
  <p>My ImageButton^</p>
  
  <pre><code>public partial class ImageButton : PictureBox, IButtonControl
      {
          #region Consturctor
          public ImageButton()
          {
              InitializeComponent();
          }
  
          public ImageButton(IContainer container)
          {
              container.Add(this);
  
              InitializeComponent();
          }
          #endregion
  
          private bool isDefault = false;
          private bool isHover = false;
          private bool isDown = false;
  
  
          #region IButtonControl Members
  
          private DialogResult m_DialogResult;
          public DialogResult DialogResult
          {
              get
              {
                  return m_DialogResult;
              }
              set
              {
                  m_DialogResult = value;
              }
          }
  
          public void NotifyDefault(bool value)
          {
              isDefault = value;
          }
  
          public void PerformClick()
          {
              base.OnClick(EventArgs.Empty);
          }
  
          #endregion
  
          #region ImageState
          private Image m_HoverImage;
          public Image HoverImage
          {
              get { return m_HoverImage; }
              set 
              { 
                  m_HoverImage = value; 
                  if (isHover) Image = value; 
              }
          }
  
          private Image m_DownImage;
          public Image DownImage
          {
              get { return m_DownImage; }
              set 
              { 
                  m_DownImage = value; 
                  if (isDown) Image = value; 
              }
          }
  
          private Image m_NormalImage;
          public Image NormalImage
          {
              get { return m_NormalImage; }
              set 
              { 
                  m_NormalImage = value; 
                  if (!(isHover || isDown)) Image = value; 
              }
          }
  
          #endregion
  
          private const int WM_KEYDOWN = 0x0100;
          private const int WM_KEYUP = 0x0101;
          #region Events
          protected override void OnMouseMove(MouseEventArgs e)
          {
              isHover = true;
              if (isDown)
              {
                  if ((m_DownImage != null) &amp;&amp; (Image != m_DownImage))
                      Image = m_DownImage;
              }
              else
                  if (m_HoverImage != null)
                      Image = m_HoverImage;
                  else
                      Image = m_NormalImage;
              base.OnMouseMove(e);
          }
  
          protected override void OnMouseLeave(EventArgs e)
          {
              isHover = false;
              Image = m_NormalImage;
              base.OnMouseLeave(e);
          }
  
          protected override void OnMouseDown(MouseEventArgs e)
          {
              base.Focus();
              OnMouseUp(null);
              isDown = true;
              if (m_DownImage != null)
                  Image = m_DownImage;
              base.OnMouseDown(e);
          }
  
          protected override void OnMouseUp(MouseEventArgs e)
          {
              isDown = false;
              if (isHover)
              {
                  if (m_HoverImage != null)
                      Image = m_HoverImage;
              }
              else
                  Image = m_NormalImage;
              base.OnMouseUp(e);
          }
  
          private bool holdingSpace = false;
  
          public override bool PreProcessMessage(ref Message msg)
          {
              if (msg.Msg == WM_KEYUP)
              {
                  if (holdingSpace)
                  {
                      if ((int)msg.WParam == (int)Keys.Space)
                      {
                          OnMouseUp(null);
                          PerformClick();
                      }
                      else if ((int)msg.WParam == (int)Keys.Escape
                          || (int)msg.WParam == (int)Keys.Tab)
                      {
                          holdingSpace = false;
                          OnMouseUp(null);
                      }
                  }
                  return true;
              }
              else if (msg.Msg == WM_KEYDOWN)
              {
                  if ((int)msg.WParam == (int)Keys.Space)
                  {
                      holdingSpace = true;
                      OnMouseDown(null);
                  }
                  else if ((int)msg.WParam == (int)Keys.Enter)
                  {
                      PerformClick();
                  }
                  return true;
              }
              else
                  return base.PreProcessMessage(ref msg);
          }
  
          protected override void OnLostFocus(EventArgs e)
          {
              holdingSpace = false;
              OnMouseUp(null);
              base.OnLostFocus(e);
          }
  
          protected override void OnPaint(PaintEventArgs pe)
          {
              base.OnPaint(pe);
              if ((!string.IsNullOrEmpty(Text)) &amp;&amp; (pe != null) &amp;&amp; (base.Font != null))
              {
                  SolidBrush drawBrush = new SolidBrush(base.ForeColor);
                  SizeF drawStringSize = pe.Graphics.MeasureString(base.Text, base.Font);
                  PointF drawPoint;
                  if (base.Image != null)
                      drawPoint = new PointF(base.Image.Width / 2 - drawStringSize.Width / 2, base.Image.Height / 2 - drawStringSize.Height / 2);
                  else
                      drawPoint = new PointF(base.Width / 2 - drawStringSize.Width / 2, base.Height / 2 - drawStringSize.Height / 2);
                  pe.Graphics.DrawString(base.Text, base.Font, drawBrush, drawPoint);
              }
          }
  
          protected override void OnTextChanged(EventArgs e)
          {
              Refresh();
              base.OnTextChanged(e);
          }
          #endregion
  
      }
  </code></pre>