当前位置:网站首页>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();边栏推荐
- Common locks in MySQL
- What data does the main account of Zhengda Meiou 4 pay attention to?
- Why can't you remember when reading? Why can't you remember- My technology learning methodology
- Embedded-c language-9-makefile/ structure / Consortium
- Starting from the classification of database, I understand the map database
- Research on the security of ognl and El expressions and memory horse
- Change deepin to Alibaba image source
- Getting started with pytest -- description of fixture parameters
- LeetCode-对链表进行插入排序
- 6.30年终小结,学生时代结束
猜你喜欢

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

Leetcode merge sort linked list

TypeScript函数详解

Record the bug of unity 2020.3.31f1 once

数学知识(欧拉函数)

Several methods of capturing packets under CS framework

C language practice - binary search (half search)

Win10 disk management compressed volume cannot be started

Solution of DM database unable to open graphical interface

One click generation and conversion of markdown directory to word format
随机推荐
Pytorch-Yolov5從0運行Bug解决:
Binary tree problem solving (2)
Virtual machine installation deepin system
Embedded-c language-9-makefile/ structure / Consortium
阿里云polkit pkexec 本地提权漏洞
win11安装pytorch-gpu遇到的坑
Alibaba cloud polkit pkexec local rights lifting vulnerability
万卷共知,一书一页总关情,TVP读书会带你突围阅读迷障!
Common errors of dmrman offline backup
Record the bug of unity 2020.3.31f1 once
二叉树解题(一)
The core idea of performance optimization, dry goods sharing
There is no prompt for SQL in idea XML, and the dialect setting is useless.
DJB Hash
oracle 存储过程与job任务设置
Leetcode merge sort linked list
ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
Beginner crawler - biqu Pavilion crawler
Deep understanding of lambda expressions
培养中小学生对教育机器人的热爱之心