Example #1
0
 public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref TBBUTTON lParam);
        private void RealizeItems()
        {
            UpdateImageList();

              for ( int i = 0; i < m_items.Count; i++ )
              {
            m_items[i].Index = i;
            m_items[i].ToolBar = this;
            TBBUTTON button = new TBBUTTON();
            button.idCommand = i;
            WindowsAPI.SendMessage(Handle, ( int )ToolBarMessages.TB_INSERTBUTTON, i, ref button);

            TBBUTTONINFO tbi = ( TBBUTTONINFO )m_items[ i ];

            WindowsAPI.SendMessage(Handle, ( int )ToolBarMessages.TB_SETBUTTONINFOW, i, ref tbi);
            if( m_items[i].Style == ToolBarItemStyle.ComboBox )
            {
              UpdateComboBoxPosition( i );
            }
              }

              UpdateSize();
        }
        internal void AddPlaceHolderToolBarItem()
        {
            placeHolderAdded = true;

              // Add it to the "native" ToolBar but not to the collection
              ToolBarItem item = new ToolBarItem();
              item.ToolBar = this;
              TBBUTTON button = new TBBUTTON();
              button.idCommand = 0;
              WindowsAPI.SendMessage(Handle, ( int )ToolBarMessages.TB_INSERTBUTTON, 0, ref button);

              int pos = m_items.IndexOf( item );
              TBBUTTONINFO tbi = (TBBUTTONINFO)m_items[ pos ];   //GetButtonInfo( 0, item );
              WindowsAPI.SendMessage(Handle, ( int )ToolBarMessages.TB_SETBUTTONINFOW, 0, ref tbi);

              UpdateSize();
        }
 public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref TBBUTTON lParam);