C#给picturebox控件加图片选中状态的2个方法
时间:2022-06-03 01:37:03
方法一:
简单的方法就是改变picturebox 控件的borderstyle样式
currentSelectPicBox.BorderStyle = BorderStyle.Fixed3D;
currentSelectPicBox.Refresh();//强制控件重新绘制
方法二
在picturebox控件加一个矩形框 但是这种方法在程序中反应比较慢。
添加矩形框的方法:
Graphics pictureborder = currentSelectPicBox.CreateGraphics();
Pen pen = new Pen(Color.Red, 2);
pictureborder.DrawRectangle(pen, currentSelectPicBox.ClientRectangle.X, currentSelectPicBox.ClientRectangle.Y, currentSelectPicBox.ClientRectangle.X + currentSelectPicBox.ClientRectangle.Width, currentSelectPicBox.ClientRectangle.Y + currentSelectPicBox.ClientRectangle.Height);
移除矩形框的方法
currentSelectPicBox.Invalidate();
如果大家有更好的方法 希望能够跟咱 分享
标签:picturebox,图片选中
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
C#缓存之SqlCacheDependency用法实例总结
2023-04-14 10:31:37
C#将Excel转成PDF的方法
2021-06-13 01:46:09
浅谈Java线程间通信之wait/notify
2022-06-09 11:26:19
![](https://img.aspxhome.com/file/2023/7/68527_0s.jpg)
JavaCV调用百度AI实现人脸检测方法详解
2023-01-09 01:16:09
![](https://img.aspxhome.com/file/2023/4/81234_0s.png)
spring boot实战之本地jar包引用示例
2021-11-01 20:44:45
MybatisPlus #{param}和${param}的用法详解
2023-02-02 13:08:10
深入理解C#之继承
2022-02-25 07:25:44
android使用PullToRefresh实现下拉刷新和上拉加载
2023-08-06 11:06:58
![](https://img.aspxhome.com/file/2023/5/85455_0s.png)
Maven构建生命周期详细介绍
2023-04-06 13:02:59
mybatis中的count()按条件查询方式
2022-06-30 06:04:29
Java新手环境搭建 Tomcat安装配置教程
2021-08-19 08:06:23
![](https://img.aspxhome.com/file/2023/4/61294_0s.jpg)
SpringMVC 域对象共享数据的实现示例
2021-07-18 15:45:57
![](https://img.aspxhome.com/file/2023/6/75016_0s.png)
Java类加载器和类加载机制实例分析
2021-07-18 03:32:26
Java设计模式之享元模式
2022-09-23 12:16:07
![](https://img.aspxhome.com/file/2023/3/66063_0s.jpg)
Java如何基于IO流实现同一文件读写操作
2023-07-30 15:06:38
基于Springboot一个注解搞定数据字典的实践方案
2022-12-23 01:12:38
Spring AOP 后置通知修改响应httpstatus方式
2022-06-05 06:54:26
![](https://img.aspxhome.com/file/2023/5/78305_0s.jpg)
java与c#的语法区别详细介绍
2022-05-02 14:01:10
SpringBoot整合freemarker实现代码生成器
2023-07-17 20:31:08
![](https://img.aspxhome.com/file/2023/5/57505_0s.jpg)
重写hashCode()和equals()方法详细介绍
2023-11-24 16:13:33
![](https://img.aspxhome.com/file/2023/8/59198_0s.png)