C#PictureBox删除图片 [英] C# PictureBox remove image

查看:1133
本文介绍了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 ?

推荐答案

我用sign.Computer随机选择了四个标志的随机组合。用户点击按钮带标志,点击
标志出现在pictureBox中。如何制作用户点击它时删除登录pictureBox并让他再次从按钮中选择签名?

哪种编程语言?

处理点击事件和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删除图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆