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

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
美团技术团队
腾讯CDC
V
V2EX
G
Google Developers Blog
博客园 - Franky
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
阮一峰的网络日志
阮一峰的网络日志
Microsoft Azure Blog
Microsoft Azure Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
罗磊的独立博客
C
Check Point Blog
MyScale Blog
MyScale Blog
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
酷 壳 – CoolShell
酷 壳 – CoolShell
V2EX - 技术
V2EX - 技术
The Last Watchdog
The Last Watchdog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
有赞技术团队
有赞技术团队
Security Archives - TechRepublic
Security Archives - TechRepublic
S
Security @ Cisco Blogs
W
WeLiveSecurity
D
DataBreaches.Net
Forbes - Security
Forbes - Security
V
Visual Studio Blog
P
Proofpoint News Feed
S
Secure Thoughts
H
Help Net Security
Cloudbric
Cloudbric
云风的 BLOG
云风的 BLOG
Microsoft Security Blog
Microsoft Security Blog
N
News and Events Feed by Topic
Schneier on Security
Schneier on Security
Engineering at Meta
Engineering at Meta
Attack and Defense Labs
Attack and Defense Labs
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
S
Security Affairs
L
LangChain Blog
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
Hacker News: Ask HN
Hacker News: Ask HN
H
Heimdal Security Blog
M
MIT News - Artificial intelligence
The Register - Security
The Register - Security

博客园 - 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提供,禁止转载。