当前位置:网站首页>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();
边栏推荐
- C language practice - binary search (half search)
- Typescript function details
- [graduation season · advanced technology Er] young people have dreams, why are they afraid of hesitation
- Win10 disk management compressed volume cannot be started
- DC-1靶场搭建及渗透实战详细过程(DC靶场系列)
- DJB Hash
- Comp 250 parsing
- Mapping location after kotlin confusion
- Thinkphp内核工单系统源码商业开源版 多用户+多客服+短信+邮件通知
- 解决:代理抛出异常错误
猜你喜欢
农业生态领域智能机器人的应用
LeetCode-归并排序链表
Unity particle Foundation
CorelDRAW Graphics Suite2022免费图形设计软件
C language practice - binary search (half search)
Typescript function details
Pytest learning ----- pytest Interface Association framework encapsulation of interface automation testing
How to modify data file path in DM database
How to recover deleted data in disk
Realize the function of data uploading
随机推荐
[improvement class] st table to solve the interval maximum value problem [2]
Hcip day 17
奠定少儿编程成为基础学科的原理
Gin framework learning code
Alibaba cloud polkit pkexec local rights lifting vulnerability
AcrelEMS高速公路微电网能效管理平台与智能照明解决方案智慧点亮隧道
6月书讯 | 9本新书上市,阵容强大,闭眼入!
I sorted out some basic questions about opencv AI kit.
Thinkphp內核工單系統源碼商業開源版 多用戶+多客服+短信+郵件通知
【提高课】ST表解决区间最值问题【2】
[C language] Dynamic Planning --- from entry to standing up
How to write a client-side technical solution
TypeScript函数详解
Introduction to Luogu 3 [circular structure] problem list solution
ansible安装与使用
The solution to the complexity brought by lambda expression
Major domestic quantitative trading platforms
IDEA xml中sql没提示,且方言设置没用。
Learn what definitelytyped is through the typescript development environment of SAP ui5
What data does the main account of Zhengda Meiou 4 pay attention to?