[VB6 ] 判斷Picture物件是否有圖片
在書上,
判斷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
討論串 (同標題文章)