当前位置:网站首页>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();边栏推荐
- Interview question: do you know the difference between deep copy and shallow copy? What is a reference copy?
- Ognl和EL表达式以及内存马的安全研究
- Detailed process of DC-1 range construction and penetration practice (DC range Series)
- Embedded-c language-9-makefile/ structure / Consortium
- Leetcode merge sort linked list
- CorelDRAW graphics suite2022 free graphic design software
- LeetCode-归并排序链表
- 社交媒体搜索引擎优化及其重要性
- LeetCode-对链表进行插入排序
- Embedded-c language-8-character pointer array / large program implementation
猜你喜欢
![[Yu Yue education] autumn 2021 reference materials of Tongji University](/img/50/5136359b89a5d047fe648637643ad0.jpg)
[Yu Yue education] autumn 2021 reference materials of Tongji University

Summary of main account information of zhengdaliu 4

Thinkphp内核工单系统源码商业开源版 多用户+多客服+短信+邮件通知

奠定少儿编程成为基础学科的原理

農業生態領域智能機器人的應用

Cannot activate CONDA virtual environment in vscode

Lm09 Fisher inverse transform inversion mesh strategy

Tawang food industry insight | current situation, consumption data and trend analysis of domestic infant complementary food market

One click generation and conversion of markdown directory to word format

Embedded-c language-9-makefile/ structure / Consortium
随机推荐
LeetCode-归并排序链表
解决:代理抛出异常错误
【提高课】ST表解决区间最值问题【2】
Yolov5 network modification tutorial (modify the backbone to efficientnet, mobilenet3, regnet, etc.)
unable to execute xxx. SH: operation not permitted
June book news | 9 new books are listed, with a strong lineup and eyes closed!
数学知识(欧拉函数)
ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
Free drawing software recommended - draw io
Use of typescript classes
Its appearance makes competitors tremble. Interpretation of Sony vision-s 02 products
Three years of experience in Android development interview (I regret that I didn't get n+1, Android bottom development tutorial
洛谷入门3【循环结构】题单题解
Gin framework learning code
Lm09 Fisher inverse transform inversion mesh strategy
Pytest learning ----- pytest Interface Association framework encapsulation of interface automation testing
Tawang food industry insight | current situation, consumption data and trend analysis of domestic infant complementary food market
CorelDRAW graphics suite2022 free graphic design software
Binary tree problem solving (2)
I sorted out some basic questions about opencv AI kit.