Sollyu
  • 捐赠
  • 关于
海内存知己 天涯若比邻
死生契阔,与子相悦。执子之手,与子偕老。
  1. 首页
  2. 原创文章
  3. 正文

C# 给按钮添加小盾牌图标

2014年12月16日 5774点热度 1人点赞 0条评论

代码

        ///////////////////////////////////////////////////////////////////////
        /// <summary>
        ///     Enables the elevated shield icon on the given button control
        /// </summary>
        /// <param name="ThisButton">
        ///     Button control to enable the elevated shield icon on.
        /// </param>
        ///////////////////////////////////////////////////////////////////////
        private void EnableElevateIcon_BCM_SETSHIELD(Button ThisButton)
        {
            // Input validation, validate that ThisControl is not null
            if (ThisButton == null)
            {
                return;
            }

            // Define BCM_SETSHIELD locally, declared originally in Commctrl.h
            uint BCM_SETSHIELD = 0x0000160C;

            // Set button style to the system style
            ThisButton.FlatStyle = FlatStyle.System;

            // Send the BCM_SETSHIELD message to the button control
            SendMessage(new System.Runtime.InteropServices.HandleRef(ThisButton, ThisButton.Handle), BCM_SETSHIELD, new IntPtr(0), new IntPtr(1));
        }

        [System.Runtime.InteropServices.DllImport("user32.dll")]
        private static extern IntPtr SendMessage(System.Runtime.InteropServices.HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

截图

C# 给按钮添加小盾牌图标

本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: C++ 小盾牌 按钮
最后更新:2014年12月16日

sollyu

关注生活,关注科技。

打赏 点赞
< 上一篇
下一篇 >

sollyu

关注生活,关注科技。

标签聚合
word-sum lua MFC mac Android VC++ swift C++

COPYRIGHT © 2015-2020 Sollyu. ALL RIGHTS RESERVED.

THEME KRATOS MADE BY VTROIS

苏ICP备15007531号