タイトル | : Re^2: 動画上に斜線を引きたい |
記事No | : 13050 |
投稿日 | : 2008/09/21(Sun) 05:08 |
投稿者 | : kamui |
> 花ちゃん ご回答ありがとうございます。
結局、下記のようなコードで、PictureBoxを透過し、難を逃れました。 アドバイス、ありがとうございました!
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Const LWA_COLORKEY = &H1 Const LWA_ALPHA = &H2 Const GWL_EXSTYLE = (-20) Const WS_EX_LAYERED = &H80000 Const GWL_HWNDPARENT As Long = -8 Const GWL_HINSTANCE As Long = -6 Const GWL_STYLE As Long = -16 Const WS_CHILD = &H40000000 Const GWL_WNDPROC As Long = -4
Private Sub Form_Load()
Dim Ret As Long
Picture1.BackColor = vbCyan SetParent Picture1.hwnd, 0 Ret = GetWindowLong(Picture1.hwnd, GWL_EXSTYLE) Ret = Ret Or WS_EX_LAYERED SetWindowLong Picture1.hwnd, GWL_EXSTYLE, Ret SetLayeredWindowAttributes Picture1.hwnd, vbCyan, 0&, LWA_COLORKEY
DoEvents
SetParent Picture1.hwnd, Me.hwnd SetWindowLong Picture1.hwnd, GWL_HWNDPARENT, Me.hwnd SetWindowLong Picture1.hwnd, GWL_HINSTANCE, App.hInstance
End Sub
|