C#学习笔记-自定义控件边框颜色
label边框
/// <summary>/// 自定义边框颜色/// </summary>public Color BorderColor { get; set; }protected override void WndProc(ref Message m){base.WndProc(ref m);if (m.Msg == 0xf || m.Msg == 0x133){if (this.BorderStyle == BorderStyle.None){System.Drawing.Pen pen = new Pen(this.BorderColor, 1);Graphics g = Graphics.FromHwnd(m.HWnd);g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;g.DrawRectangle(pen, 0, 0, this.Width -1, this.Height-1);pen.Dispose();}//返回结果m.Result = IntPtr.Zero;}}
richtextbox
/// <summary>/// 自定义边框颜色/// </summary>public Color BorderColor { get; set; }protected override void WndProc(ref Message m){base.WndProc(ref m);if (m.Msg == 0xf || m.Msg == 0x133){if (this.BorderStyle == BorderStyle.None){System.Drawing.Pen pen = new Pen(this.BorderColor, 1);Graphics g = Graphics.FromHwnd(m.HWnd);g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);pen.Dispose();}//返回结果m.Result = IntPtr.Zero;}}
textbox
/// <summary>/// 自定义边框颜色/// </summary>public Color BorderColor { get; set; }protected override void WndProc(ref Message m){base.WndProc(ref m);if (m.Msg == 0xf || m.Msg == 0x133){if (this.BorderStyle == BorderStyle.FixedSingle){System.Drawing.Pen pen = new Pen(this.BorderColor, 1);Graphics g = Graphics.FromHwnd( m.HWnd);g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);pen.Dispose();}//返回结果m.Result = IntPtr.Zero;}}
comboBox
/// <summary>/// 自定义边框颜色/// </summary>public Color BorderColor { get; set; }protected override void WndProc(ref Message m){base.WndProc(ref m);if (m.Msg == 0xf || m.Msg == 0x133){if (this.FlatStyle == FlatStyle.Flat){System.Drawing.Pen pen = new Pen(this.BorderColor, 1);Graphics g = Graphics.FromHwnd(m.HWnd);g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);pen.Dispose();}//返回结果m.Result = IntPtr.Zero;}}
C#学习笔记-自定义控件边框颜色相关推荐
- Halcon 学习笔记八:颜色识别
Halcon 学习笔记八:颜色识别 一.图像处理需要的知识 二.图像处理的预处理和分割过程 二.颜色识别的方法 三.例子一 四.例子二 五.例子三 一.图像处理需要的知识 1.图像处理基础(rgb(h ...
- 【Python学习笔记】猜颜色小游戏
[Python学习笔记]猜颜色小游戏 前言 一.算法原理 1. 生成器部分 2. 检测器部分 二.代码 过程BUG汇总笔记 总结 前言 最近馋世界游戏大全51,心血来潮用Python写了个猜颜色,顺便 ...
- RT-Thread学习笔记|TCS34725 RGB 颜色识别传感器详解
rt-thread是什么? RT-Thread 是一个集实时操作系统(RTOS)内核.中间件组件和开发者社区于一体的技术平台,组件完整丰富.高度可伸缩.简易开发.超低功耗.高安全性的物联网操作系统.R ...
- bat批处理命令解析和学习笔记/CMD窗口颜色永久修改
bat帮助 最好的方式就是 进入百度BAThttps://baike.baidu.com/item/bat/365230?fr=aladdin 或 进入百度文库https://wenku.baidu. ...
- Android学习笔记之图像颜色处理(ColorMatrix)
对图像进行颜色方面的处理,通过使用颜色矩阵(ColorMatrix)来实现.从而可以达到很多特效如黑白老照片.泛黄旧照片等等. 1.颜色矩阵(ColorMatrix) 这里有详细的介绍:http:// ...
- unity学习笔记~材质金属颜色对照表
材质金
- SilverLight学习笔记--建立Silverlight自定义控件(5)--绑定动画效果
有了上述的基础,我们进一步完善我们的自定义控件,在此我们将创建Storyboard和前面的添加事件处理方法为我们的自定义控件加上动画效果. 1.首先,在MyDesignButton项目中进一步完善 ...
- html制作网站边框,HTML学习笔记☆边框制作
HTML学习笔记☆边框制作 代码: 填入内容 填入内容 填入内容 填入内容 填入内容 填入内容 填入内容 填入内容 填入内容 以上代码确切地说是表格代码,把括号内文字改成数字或去掉,变成以下代码形式: ...
- opengl 设置每个点的颜色_OpenGL学习笔记(四)着色器
本文为学习LearnOpenGL的学习笔记,如有书写和理解错误还请大佬扶正: 教程链接: 着色器 - LearnOpenGL CNlearnopengl-cn.github.io 一,基础概念 1, ...
最新文章
- Android 自定义View之3D骰子旋转
- about ajax,About 4nf.org - Arvind Gupta | Ajaxify | The Ajax Plugin
- Feature Selection: A Data Perspective --阅读笔记2 传统数据的特征选择算法
- 前端框架MVC/MVVM分析系列
- 二叉树的四种遍历方法:前序、中序、后序、层次
- Angularjs实现下拉框自动匹配键值对对象技巧
- 起点海外版 Hybrid App-内嵌页优化实践
- TensorFlow4-常量和变量及TensorBoard使用
- Unity第一人称可视化传送门制作
- 徐小湛概率论与数理统计课件_概率论与数理统计视频教程下载
- 钟控RS,D,JK,T触发器
- 剑指offer--46.47.发散思维能力
- deepin安装tftp服务器_Win10频发蓝屏,深度Deepin系统,调试华为AC和AP
- java ppt 绘图,PPT图片别再直接插入,这样处理一下,让你的PPT秒变高逼格
- 【Java】Spring 教程
- 传奇人物赫伯特·西蒙的原则
- anemometer mysql5.6_Anemometer 慢查询日志监控平台
- 另眼看嘀嘀:打车类应用背后的政策风险
- 八叉树和十六叉树结构
- 【Agile框架(一)】首页布局
热门文章
- STM32无系统移植CanFestival小白教程
- 怎样检测你的IE使用的代理服务器
- JS 生成uuid(v4)
- php mod rewrite.so,开启Apache mod_rewrite模块完全解答
- android中各种Intent跳转(邮件、音频、联系人....)
- include and extend
- AMD三核、六核安装SQL2000
- nyoj 203 三国志 dijkstra+01背包
- 编程输入年份和月份,输出该月份有多少天。
- 使用Hprose制作一个简单的分布式应用程序