GetTBBUTTON() private method

private GetTBBUTTON ( int commandId ) : System.Windows.Forms.NativeMethods.TBBUTTON
commandId int
return System.Windows.Forms.NativeMethods.TBBUTTON
Esempio n. 1
0
        /// <include file='doc\ToolBar.uex' path='docs/doc[@for="ToolBar.InsertButton"]/*' />
        /// <devdoc>
        ///    <para>Inserts a button at a given location on the toolbar control.</para>
        /// </devdoc>
        private void InsertButton(int index, ToolBarButton value) {

            if (value == null)
                throw new ArgumentNullException("value");
            if (index < 0 || ((buttons != null) && (index > buttonCount)))
                throw new ArgumentOutOfRangeException("index", SR.GetString(SR.InvalidArgument, "index", index.ToString(CultureInfo.CurrentCulture)));

            // insert the button into our local array, and then into the
            // real windows ToolBar control
            //
            Insert(index, value);
            if (IsHandleCreated) {
                NativeMethods.TBBUTTON tbbutton = value.GetTBBUTTON(index);
                UnsafeNativeMethods.SendMessage(new HandleRef(this, Handle), NativeMethods.TB_INSERTBUTTON, index, ref tbbutton);
            }
            UpdateButtons();
        }
 private void InsertButton(int index, ToolBarButton value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if ((index < 0) || ((this.buttons != null) && (index > this.buttonCount)))
     {
         throw new ArgumentOutOfRangeException("index", System.Windows.Forms.SR.GetString("InvalidArgument", new object[] { "index", index.ToString(CultureInfo.CurrentCulture) }));
     }
     this.Insert(index, value);
     if (base.IsHandleCreated)
     {
         System.Windows.Forms.NativeMethods.TBBUTTON tBBUTTON = value.GetTBBUTTON(index);
         System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, base.Handle), System.Windows.Forms.NativeMethods.TB_INSERTBUTTON, index, ref tBBUTTON);
     }
     this.UpdateButtons();
 }