当前位置:网站首页>C# 图片显示占用问题
C# 图片显示占用问题
2022-07-02 04:48:00 【dancebit】
控件上显示图片
pictureBox1.Image = Image.FromFile("1.jpg");实际使用没问题,但是图片会被占用,删除都不行。
图片赋值之后pictureBox1并不会立即刷新,如果立即释放image.Dispose() 会导致图片后面pictureBox1刷新时找不到资源报错。所以在释放前刷新图片控件pictureBox1.Refresh() 即可 释放文件。
实现如下:
var image = Image.FromFile("1.jpg");
pictureBox1.Image = image;
pictureBox1.Refresh();
image.Dispose();边栏推荐
- 06 装饰(Decorator)模式
- CorelDRAW Graphics Suite2022免费图形设计软件
- geotrust ov多域名ssl證書一年兩千一百元包含幾個域名?
- Common locks in MySQL
- How to modify data file path in DM database
- Getting started with pytest ----- confitest Application of PY
- Research on the security of ognl and El expressions and memory horse
- 【毕业季·进击的技术er】年少有梦,何惧彷徨
- List of common bugs in software testing
- Deep understanding of lambda expressions
猜你喜欢
随机推荐
One step implementation of yolox helmet detection (combined with oak intelligent depth camera)
TypeScript类的使用
记录一次Unity 2020.3.31f1的bug
Hcip day 17
TypeScript函数详解
Record the bug of unity 2020.3.31f1 once
Vmware安装win10报错:operating system not found
正大美欧4的主账户关注什么数据?
Learn BeanShell before you dare to say you know JMeter
Mysql表insert中文变?号的问题解决办法
Detailed process of DC-1 range construction and penetration practice (DC range Series)
社交媒体搜索引擎优化及其重要性
Common errors of dmrman offline backup
【ClickHouse】How to create index for Map Type Column or one key of it?
Virtual machine installation deepin system
unable to execute xxx. SH: operation not permitted
Online incremental migration of DM database
Landing guide for "prohibit using select * as query field list"
Arbre binaire pour résoudre le problème (2)
Future trend of automated testing ----- self healing technology









