[Reference] : 진진, 「비주얼 베이직 개발 - 반투명 처리 퍼옴」 http://antidebug.coolsoft2.com/?mid=vb_dev&document_srl=747530.


Option Explicit
Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hdc As Long) As Long
Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Declare Function GetForegroundWindow Lib "user32" () As Long
Declare Function BitBlt Lib "GDI32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Const SRCCOPY = &HCC0020
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Const HTCAPTION = 2
Public iRecursion As Boolean
Public Hcolor As Long

'반투명
Public Sub T_P(T_Pic As PictureBox, Optional Hcolor As Long)
On Local Error Resume Next
Dim HW As Long
Dim HA As Long
Dim iLeft As Integer
Dim iTop As Integer
Dim iWidth As Integer
Dim iHeight As Integer
If IsMissing(Hcolor) Or Hcolor = 0 Then
Hcolor = RGB(1, 255, 185) '원하는 색 지정
'Hcolor = RGB(0, 0, 0) 'GetForegroundWindow()
End If
T_Pic.AutoRedraw = True
T_Pic.Visible = False
DoEvents
HW = GetForegroundWindow()
HA = GetDC(HW)
iLeft = T_Pic.Left / Screen.TwipsPerPixelX
iTop = T_Pic.Top / Screen.TwipsPerPixelY
iWidth = T_Pic.ScaleWidth
iHeight = T_Pic.ScaleHeight
'Call BitBlt(T_Pic.hdc, 0, 0, iWidth, iHeight, HA, iLeft + 1, iTop + 1, SRCCOPY)
Call BitBlt(T_Pic.hdc, 0, 0, iWidth, iHeight, HA, T_Pic.Left, T_Pic.Top, SRCCOPY)
Call ReleaseDC(HW, HA)
T_Pic.DrawMode = 9
T_Pic.ForeColor = Hcolor
T_Pic.Line (0, 0)-(iWidth, iHeight), , BF
T_Pic.Visible = True
End Sub

'사용

Call T_P(Me.Car_Detect, Hcolor)





흠..... 해보니 반투명 안되는데.....-_-;;;;;;

'P/L > Visual Basic' 카테고리의 다른 글

정수를 4의 배수로 만들기  (0) 2011.12.18
Visual Basic] 랜덤함수 Rnd() 와 Randomize  (0) 2011.12.15
MsgBox  (0) 2011.12.13
KeyDown(KeyUP)과 KeyPress의 차이점  (0) 2011.12.08
[Visual Basic] WindowState 속성  (0) 2011.12.07
Posted by 야동우
,