当前位置:网站首页>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();边栏推荐
- Detailed process of DC-1 range construction and penetration practice (DC range Series)
- Typescript function details
- MySQL table insert Chinese change? Solution to the problem of No
- Pytoch --- use pytoch to realize u-net semantic segmentation
- Solution of DM database unable to open graphical interface
- How to recover deleted data in disk
- geotrust ov多域名ssl证书一年两千一百元包含几个域名?
- Ruby replaces gem Alibaba image
- Embedded-c language-9-makefile/ structure / Consortium
- Pytoch --- use pytoch to predict birds
猜你喜欢

Orthogonal test method and function diagram method for test case design

Leetcode- insert and sort the linked list

Change deepin to Alibaba image source

win10 磁盘管理 压缩卷 无法启动问题

Idea autoguide package and autodelete package Settings

Ognl和EL表达式以及内存马的安全研究

Rhcsa --- work on the fourth day

Leetcode merge sort linked list

win11安装pytorch-gpu遇到的坑

社交媒体搜索引擎优化及其重要性
随机推荐
Pytorch-Yolov5從0運行Bug解决:
Social media search engine optimization and its importance
Cannot activate CONDA virtual environment in vscode
Research on the security of ognl and El expressions and memory horse
Mysql database learning
培养中小学生对教育机器人的热爱之心
There is no prompt for SQL in idea XML, and the dialect setting is useless.
Use of Baidu map
Mouse events in JS
Free drawing software recommended - draw io
Steam教育的实际问题解决能力
Rhcsa --- work on the third day
Pytoch --- use pytoch for image positioning
DMA Porter
洛谷入门3【循环结构】题单题解
C - derived classes and constructors
Change deepin to Alibaba image source
Arbre binaire pour résoudre le problème (2)
My first experience of shadowless cloud computer
MySQL table insert Chinese change? Solution to the problem of No