當前位置: 首頁>>代碼示例>>C#>>正文


C# ToolBarButton.GetTBBUTTONINFO方法代碼示例

本文整理匯總了C#中System.Windows.Forms.ToolBarButton.GetTBBUTTONINFO方法的典型用法代碼示例。如果您正苦於以下問題:C# ToolBarButton.GetTBBUTTONINFO方法的具體用法?C# ToolBarButton.GetTBBUTTONINFO怎麽用?C# ToolBarButton.GetTBBUTTONINFO使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.ToolBarButton的用法示例。


在下文中一共展示了ToolBarButton.GetTBBUTTONINFO方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: InternalSetButton

        /// <include file='doc\ToolBar.uex' path='docs/doc[@for="ToolBar.InternalSetButton"]/*' />
        /// <devdoc>
        ///     Changes the data for a button in the ToolBar, and then does the appropriate
        ///     work to update the ToolBar control.
        /// </devdoc>
        /// <internalonly/>
        internal void InternalSetButton(int index, ToolBarButton value, bool recreate, bool updateText) {

            // tragically, there doesn't appear to be a way to remove the
            // string for the button if it has one, so we just have to leave
            // it in there.
            //
            buttons[index].parent = null;
            buttons[index].stringIndex = (IntPtr)(-1);
            buttons[index] = value;
            buttons[index].parent = this;

            if (IsHandleCreated) {
                NativeMethods.TBBUTTONINFO tbbi = value.GetTBBUTTONINFO(updateText, index);
                UnsafeNativeMethods.SendMessage(new HandleRef(this, Handle), NativeMethods.TB_SETBUTTONINFO, index, ref tbbi);

                if (tbbi.pszText != IntPtr.Zero) {
                    Marshal.FreeHGlobal(tbbi.pszText);
                }

                if (recreate) {
                    UpdateButtons();
                }
                else {
                    // after doing anything with the comctl ToolBar control, this
                    // appears to be a good idea.
                    //
                    SendMessage(NativeMethods.TB_AUTOSIZE, 0, 0);

                    ForceButtonWidths();
                    this.Invalidate();
                }
            }
        }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:39,代碼來源:ToolBar.cs

示例2: InternalSetButton

 internal void InternalSetButton(int index, ToolBarButton value, bool recreate, bool updateText)
 {
     this.buttons[index].parent = null;
     this.buttons[index].stringIndex = (IntPtr) (-1);
     this.buttons[index] = value;
     this.buttons[index].parent = this;
     if (base.IsHandleCreated)
     {
         System.Windows.Forms.NativeMethods.TBBUTTONINFO tBBUTTONINFO = value.GetTBBUTTONINFO(updateText, index);
         System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, base.Handle), System.Windows.Forms.NativeMethods.TB_SETBUTTONINFO, index, ref tBBUTTONINFO);
         if (tBBUTTONINFO.pszText != IntPtr.Zero)
         {
             Marshal.FreeHGlobal(tBBUTTONINFO.pszText);
         }
         if (recreate)
         {
             this.UpdateButtons();
         }
         else
         {
             base.SendMessage(0x421, 0, 0);
             this.ForceButtonWidths();
             base.Invalidate();
         }
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:26,代碼來源:ToolBar.cs


注:本文中的System.Windows.Forms.ToolBarButton.GetTBBUTTONINFO方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。