当前位置:网站首页>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();
边栏推荐
- Beginner crawler - biqu Pavilion crawler
- CorelDRAW Graphics Suite2022免费图形设计软件
- Pytoch --- use pytoch to realize u-net semantic segmentation
- Hcip day 17
- How do I interview for a successful software testing position? If you want to get a high salary, you must see the offer
- LeetCode-归并排序链表
- [Yu Yue education] autumn 2021 reference materials of Tongji University
- Pytorch yolov5 exécute la résolution de bogues à partir de 0:
- 正大留4的主账户信息汇总
- Thinkphp內核工單系統源碼商業開源版 多用戶+多客服+短信+郵件通知
猜你喜欢
Summary of main account information of zhengdaliu 4
VMware installation win10 reports an error: operating system not found
Gin framework learning code
Pit encountered in win11 pytorch GPU installation
Detailed process of DC-1 range construction and penetration practice (DC range Series)
List of common bugs in software testing
Starting from the classification of database, I understand the map database
Landing guide for "prohibit using select * as query field list"
Let正版短信测压开源源码
Ognl和EL表达式以及内存马的安全研究
随机推荐
关于Steam 教育的知识整理
idea自动导包和自动删包设置
Markdown编辑语法
Binary tree problem solving (1)
Its appearance makes competitors tremble. Interpretation of Sony vision-s 02 products
Starting from the classification of database, I understand the map database
Rhcsa --- work on the fourth day
Pytoch --- use pytoch to realize u-net semantic segmentation
Introduction to Luogu 3 [circular structure] problem list solution
June book news | 9 new books are listed, with a strong lineup and eyes closed!
Rhcsa --- work on the third day
MySQL table insert Chinese change? Solution to the problem of No
Research on the security of ognl and El expressions and memory horse
LeetCode-归并排序链表
DMA Porter
10 minute quick start UI automation ----- puppeter
What are the rules and trading hours of agricultural futures contracts? How much is the handling fee deposit?
Thinkphp Kernel wo system source Commercial Open source multi - user + multi - Customer Service + SMS + email notification
6月书讯 | 9本新书上市,阵容强大,闭眼入!
Realize the function of data uploading