VB範例網 http://www.vbex.net


表單不見了,控制項還在:

參考網友鵬鵬天神的做法:

Option Explicit
'此原程式碼雖然簡單及很爛,
'但也是我的心血,
'請不要把它糟塌
'如不是用在商業用途的話,
'歡迎任意轉載。
'但希望注明此程式碼的來源地。
'我的名字:鵬鵬天神
'我的網頁:http://big5.to/天神大富翁
'我的郵箱:ippan@sinaman.com
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long

Private Sub cmdText_Click()
  Unload Me
End Sub

Private Sub Form_Load()
Dim TempBitmap As Long
  TempBitmap = CreateCompatibleBitmap(Me.hdc, 0, 0)
  Me.AutoRedraw = True
  SelectObject Me.hdc, TempBitmap
  Me.AutoRedraw = False
End Sub

另一種做法:

Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long

Private Sub Form_Load()
  SetParent Picture1.hwnd, GetParent(Me.hwnd) 'Picture1的父母設定為成Form1的父母,使Picture1放在桌面上
  Me.Visible = False
End Sub

Private Sub Picture1_Click()
  End
End Sub


上一頁