当前位置: 首页>>代码示例>>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;未经允许,请勿转载。