作者A1pha ([αλφα])
看板Visual_Basic
标题[VB6 ] 判断Picture物件是否有图片
时间Sun Feb 1 17:13:32 2009
在书上,
判断Picture图片是否含有物件的函式是这样写的:
Function HasPicture(pic As Picture) As Boolean
If pic Is Nothing Then
HasPicture = False
ElseIf pic.Handle = 0 Then
HasPicture = False
Else
HasPicture = True
End If
End Function
但是我有个问题,
为什麽要分别对pic.Handle、pic Is Nothing做两次判断?
难道当pic=Nothing之後,pic.handle还会存在吗?
不能直接判断pic Is Nothing或是pic.handle的其中一个就可以吗?
--
"Every kid who has dreamed of being a baseball player has stood in his front
yard with a bat and said to himself, "Bottom of the ninth, Game 7 of the
World Series, the bases are loaded," and then envisioned hitting a home run
to win the game. My job is to shatter that dream."
By Huston Street
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 124.9.135.148