www.rjpf.net > C#中清空piCturEBox内容

C#中清空piCturEBox内容

Graphics g = pictureBox.CreateGraphics(); g.Clear();

pictureBox.Image = null 可以了。 或者 pictureBox.Image.Dispose().

清除image: Graphics g = Graphics.FromImage(pictureBox1.Image); g.Clear(Color.White); g.Dispose(); pictureBox1.Refresh(); 清除背景: Graphics g = Graphics.FromImage(pictureBox1.BackgroundImage); g.Clear(Color.White); g.Dispose(...

this.picBox.Image=null;

PictureBox加载图片后,再将Image属性值设置为null,但本地图片仍无法删除,提示文件正被另一个程序使用,相关代码: //显示图片 private void button1_Click(object sender, EventArgs e) { pictureBox1.Image = Image.FromFile(@"f:\demo.gif"...

this.pictureBox1.Image = null;

再绘制一次,用绘图对象的clear方法

Graphics dc = pictureBox.CreateGraphics(); dc.Clear(Color.White);

foreach (var item in this.panel1.Controls) { if (item is PictureBox) { ((PictureBox)item).Image = null; } } 如果是全部都是PIctureBox : this.panel1.Controls.Clear();

是PictureBox这个控件吧? pictureBox1.Image = null; 就可以清空了。

网站地图

All rights reserved Powered by www.rjpf.net

copyright ©right 2010-2021。
www.rjpf.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com