惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
O
OpenAI News
V
V2EX
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
S
Schneier on Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
小众软件
小众软件
L
LINUX DO - 热门话题
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - Franky
Security Latest
Security Latest
S
SegmentFault 最新的问题
Project Zero
Project Zero
Spread Privacy
Spread Privacy
K
Kaspersky official blog
J
Java Code Geeks
V
Vulnerabilities – Threatpost
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
月光博客
月光博客
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
人人都是产品经理
人人都是产品经理
博客园 - 三生石上(FineUI控件)
Scott Helme
Scott Helme
WordPress大学
WordPress大学
量子位
T
Threat Research - Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
AWS News Blog
AWS News Blog
Help Net Security
Help Net Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Simon Willison's Weblog
Simon Willison's Weblog
S
Secure Thoughts
博客园 - 【当耐特】
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
V
Visual Studio Blog
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
腾讯CDC
Cyberwarzone
Cyberwarzone
IT之家
IT之家
GbyAI
GbyAI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
云风的 BLOG
云风的 BLOG
T
Troy Hunt's Blog
D
Docker

博客园 - weekzero

百度编辑器ueditor批量上传图片或者批量上传文件时,文件名称和内容不符合,错位问题 代码漏洞扫描描述Cross Site History Manipulation解决办法[dongcoder.com] iis重写模块实现程序自动二级域名,微软提供的URL重写2.0版本适用IIS以上 借助微软提供的url重写类库URLRewriter.dll(1.0)实现程序自动二级域名,域名需要泛解析 AspNetPager控件报错误: Syntax error, unrecognized expression: input#ctl00$ContentPlaceHolder1$Aspnetpager1_input问题解决[摘] 精准定位才能赢得人心 IIS7.5打开GZip压缩,同时启用GZip压缩JS/CSS文件的设置方法 c#变量缺少using引用,如何快速加上using,加Using的快捷键 chart.js插件生成折线图时数据普遍较大时Y轴数据不从0开始的解决办法 要用于尝试,广东移动间接实现“流量不清零” jquery中ajax在firefox浏览器下“object XMLDocument”返回结果的解决办法 mvc中Url.RouteUrl或者Html.RouteLink实现灵活超链接,使href的值随路由名称或配置的改变而改变 mvc中多参数URL会很长,首次加载不传参数让url很短,路由规则实现方法 《舌尖上的中国》第二季今日首播了,天猫食品也跟着首发,借力使力 Ubuntu 14.04 (Trusty Tahr) LTS发布,附下载地址,各种镜像 System.Data.OleDb操作access数据库类 大数据量下,分页的解决办法 winform里操作打开在panel里的form窗体,子窗体操作同级子窗体或者父窗体的方法 cWeb开发框架,基于asp.net的cWeb应用开发平台介绍(二)
winform设置button的边框颜色,或取消边框颜色,不显示边框
weekzero · 2014-01-11 · via 博客园 - weekzero

winform设置边框颜色不像webform那么简单,可以通过设置FlatAppearance,也可以通过重绘实现。

一、设置按钮本身属性

buttonBubufx.FlatStyle = FlatStyle.Flat;
buttonBubufx.BackColor = Color.SkyBlue;
buttonBubufx.FlatAppearance.BorderColor = buttonBubufx.BackColor;

二、重绘,设置按钮的Region

 private static int WM_NCPAINT = 0x0085;
        private static int WM_ERASEBKGND = 0x0014;
        private static int WM_PAINT = 0x000F;

        [DllImport("user32.dll")]
        static extern IntPtr GetDCEx(IntPtr hwnd, IntPtr hrgnclip, uint fdwOptions);

        [DllImport("user32.dll")]
        static extern int ReleaseDC(IntPtr hwnd, IntPtr hDC);

        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            if (m.Msg == WM_NCPAINT || m.Msg == WM_ERASEBKGND || m.Msg == WM_PAINT)
            {
                IntPtr hdc = GetDCEx(m.HWnd, (IntPtr)1, 1 | 0x0020);

                if (hdc != IntPtr.Zero)
                {
                    Graphics graphics = Graphics.FromHdc(hdc);
                    Color borderColor = Color.HotPink;

                    Rectangle rectangle = new Rectangle(textBox1.Location.X, textBox1.Location.Y + (25), textBox1.Width, textBox1.Height);
                    ControlPaint.DrawBorder(graphics, rectangle, borderColor, ButtonBorderStyle.Solid);
                    m.Result = (IntPtr)1;
                    ReleaseDC(m.HWnd, hdc);

                }
            }
        }

原帖地址:winform设置button的边框颜色,或取消边框颜色,不显示边框。

bubuko.com提供,禁止转载。