有关Nothing

CoolQ 2003-11-09 12:59:12
我用set picturebox1.picture = nothing来清空picturebox1的图像
但是我立即用if picturebox1.picture is nothing来判断,怎么是假呢?

也就是说以下的程序没有弹出对话框
set picture1.picture = nothing
if picture1.picture is nothing then
msgbox "hello,world"
end if
...全文
99 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zerg2001 2004-02-02
  • 打赏
  • 举报
回复
这个问题很有趣,
我用过这种方法清空:
Picture1.Picture=""
也可以,不过如果用if,也会不等。
drillmaster 2004-02-02
  • 打赏
  • 举报
回复
If Obj Is Nothing Then dosomething
rainstormmaster 2003-11-09
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
Set Picture1.Picture = Nothing

If Picture1.Picture = 0 Then
MsgBox "hello world"
End If
End Sub
kimurakenshin 2003-11-09
  • 打赏
  • 举报
回复
参考:
Set Picture1 = Nothing
If Picture1 = 0 Then
MsgBox "hello,world"
End If

Cls 方法


清除运行时 Form 或 PictureBox 所生成的图形和文本。

语法

object.Cls

object 所在处代表一个对象表达式,其值为“应用于”列表中的一个对象。如果省略 object,则带有焦点的 Form 就被认为是 object。

说明

Cls 将清除图形和打印语句在运行时所产生的文本和图形,而设计时在 Form 中使用 Picture 属性设置的背景位图和放置的控件不受 Cls 影响。如果激活 Cls 之前 AutoRedraw 属性设置为 False, 调用时该属性设置为 True,则放置在 Form 或 PictureBox 中的图形和文本也不受影响。 这就是说,通过对正在处理的对象的 AutoRedraw 属性进行操作,可以保持 Form 或 PictureBox 中的图形和文本。

调用 Cls 之后,object 的 CurrentX 和 CurrentY 属性复位为 0。
dsclub 2003-11-09
  • 打赏
  • 举报
回复
Debug.Print Picture1.Picture.Handle

Set Picture1.Picture = Nothing

Debug.Print Picture1.Picture.Handle

判断Picture1.Picture.Handle是否为0
subzero 2003-11-09
  • 打赏
  • 举报
回复
picturebox的picture并不是一个对象,不能用set nothing来清除
picturebox1.cls

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧