[VB6 ] 判斷Picture物件是否有圖片

看板Visual_Basic作者 ([αλφα])時間15年前 (2009/02/01 17:13), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
在書上, 判斷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
文章代碼(AID): #19XMV1cH (Visual_Basic)
文章代碼(AID): #19XMV1cH (Visual_Basic)