ピクチャボックスをフローティング表示 <TOP>
ReleaseCapture マウスのキャプチャを解放
SendMessage ウィンドウにメッセージを送信
'================================================================ '= ピクチャボックスをフローティング表示 '= (WM_NCLBUTTONDOWN.bas) '================================================================ #include "Windows.bi" #define WM_NCLBUTTONDOWN &HA1 '非クライアント領域で左マウスボタンを押す #define HTCAPTION 2 'タイトルバーをクリックしたことを示す ' マウスのキャプチャを解放 Declare Function Api_ReleaseCapture& Lib "user32" Alias "ReleaseCapture" () ' ウィンドウにメッセージを送信 Declare Function Api_SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hWnd&, ByVal wMsg&, ByVal wParam&, lParam As Any) Var Shared Picture1 As Object Var Shared Check1 As Object Var SHared Bitmap As Object Picture1.Attach GetDlgItem("Picture1") Check1.Attach GetDlgItem("Check1") : Check1.SetFontSize 14 BitmapObject Bitmap '================================================================ '= '================================================================ Declare Sub Picture1_MouseDown edecl (Button As Integer, Shift As Integer, x As Single, y As Single) Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) Var Ret As Long If Check1.GetCheck = 1 Then Ret = Api_ReleaseCapture() Ret = Api_SendMessage(Picture1.GethWnd, WM_NCLBUTTONDOWN, ByVal HTCAPTION, ByVal 0) End If End Sub '================================================================ '= '================================================================ Declare Sub MainForm_Start edecl () Sub MainForm_Start() Bitmap.LoadFile "bike.bmp" Picture1.DrawBitmap Bitmap, 0, 0 Bitmap.DeleteObject End Sub '================================================================ '= '================================================================ While 1 WaitEvent Wend Stop End