本文介绍了C#PictureBox删除图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了带有标志的游戏。计算机随机选择要找到的四个标志的随机组合。用户点击按钮,点击
标志出现在pictureBox中。当用户点击它时如何删除登录pictureBox并让他再次从按钮中选择标记? / span>
I have created game with signs.Computer randomly select random combination of four signs to be found.User click button with sign and clicked sign appears in pictureBox.How to make to remove sign in pictureBox when user clicks on it and let him select sign from button again ?
推荐答案
哪种编程语言?
处理点击事件和c#:
Image iOld = this.pictureBox1.Image;
this.pictureBox1.Image = null;
if(iOld != null)
iOld.Dispose();
VB:
Dim iOld as Image = Me.PictureBox1.Image
Me.PictureBox1.Image = Nothing
If Not iOld Is Nothing Then
iOld.Dispose()
End If
假设pictureBox被命名为pictureBox1
assuming the pictureBox is named pictureBox1
问候,
Thorsten
Thorsten
这篇关于C#PictureBox删除图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!