VB的例程,想要吗?参考一下也好!Public Sub MakeTranslucent(Who As Form, Optional tColor As Long) 'Was (Who as Object) before...On Local Error Resume NextDim HW As Long Dim HA As Long Dim iLeft As Integer Dim iTop As Integer Dim iWidth As Integer Dim iHeight As IntegerIf IsMissing(tColor) Or tColor = 0 Then tColor = RGB(0, 0, 200) End IfWho.AutoRedraw = True Who.HideDoEventsHW = GetDesktopWindow() HA = GetDC(HW)'Get the Left, Top, Width and Height of the Form... iLeft = Who.Left / Screen.TwipsPerPixelX iTop = Who.Top / Screen.TwipsPerPixelY '+ 25 If using a form with a titlebar (border)... iWidth = Who.ScaleWidth iHeight = Who.ScaleHeight'Now, Transfer the contents of the Desktop Window to the Form... Call BitBlt(Who.hdc, 0, 0, iWidth, iHeight, HA, iLeft, iTop, SRCCOPY) 'iLeft + 4 If using a form with a titlebar (border)...'Show... Who.Picture = Who.Image Who.Show'Release the DC... Call ReleaseDC(HW, HA)'Add color... Who.DrawMode = 9 Who.ForeColor = tColor Who.Line (0, 0)-(iWidth, iHeight), , BFEnd Sub加入以上声明后在程序里调用方法:Call MakeTranslucent(Form1, tColor)
Dim HA As Long
Dim iLeft As Integer
Dim iTop As Integer
Dim iWidth As Integer
Dim iHeight As IntegerIf IsMissing(tColor) Or tColor = 0 Then
tColor = RGB(0, 0, 200)
End IfWho.AutoRedraw = True
Who.HideDoEventsHW = GetDesktopWindow()
HA = GetDC(HW)'Get the Left, Top, Width and Height of the Form...
iLeft = Who.Left / Screen.TwipsPerPixelX
iTop = Who.Top / Screen.TwipsPerPixelY '+ 25 If using a form with a titlebar (border)...
iWidth = Who.ScaleWidth
iHeight = Who.ScaleHeight'Now, Transfer the contents of the Desktop Window to the Form...
Call BitBlt(Who.hdc, 0, 0, iWidth, iHeight, HA, iLeft, iTop, SRCCOPY) 'iLeft + 4 If using a form with a titlebar (border)...'Show...
Who.Picture = Who.Image
Who.Show'Release the DC...
Call ReleaseDC(HW, HA)'Add color...
Who.DrawMode = 9
Who.ForeColor = tColor
Who.Line (0, 0)-(iWidth, iHeight), , BFEnd Sub加入以上声明后在程序里调用方法:Call MakeTranslucent(Form1, tColor)