'透明窗体(hWind,透明百分比,色彩,鼠标穿透)
'=-1,表示不设置，
'透明百分比,色彩 同时=-1，恢复成不透明
'透明百分比：  0-100 ，0时不透明，100为全透明
'色彩：        窗口上的某个颜色为全透明，且鼠标会穿透 透明区
'鼠标穿透：    整个窗口，鼠标点击不到，只能是能看到，但是好像不存在一样。
Sub SetTransparentWin(hWndID as HWnd, ByVal Percent as Long = -1, ByVal nColor as Long = -1, ByVal Wear as Long = 0)
   '窗口Id as HWnd, ByVal 透明百分比 as Long = -1, ByVal 色彩 as Long = -1, ByVal 鼠标穿透 as Long = 0
   Dim Rtn as Long, a as Long
   If Percent > -1 Then a = (100 - Percent) * 2.55 Else a = 0
   
   
   'Rtn = GetWindowLong(hWndID, GWL_EXSTYLE)
   If Wear Then
      AfxAddWindowExStyle hWndID, &H20
      'Rtn = Rtn Or WS_EX_LAYERED Or &H20
   Else
      AfxRemoveWindowExStyle hWndID, &H20
      'Rtn = Rtn Or WS_EX_LAYERED
   End If
   AfxAddWindowExStyle hWndID, WS_EX_LAYERED
   'SetWindowLong hWndID, GWL_EXSTYLE, Rtn
   If Percent >= 0 And nColor >= 0 Then
      SetLayeredWindowAttributes hWndID, nColor, a, LWA_ALPHA Or LWA_COLORKEY
   ElseIf nColor > 0 Then
      SetLayeredWindowAttributes hWndID, nColor, 0, LWA_COLORKEY
   ElseIf Percent >= 0 Then
      SetLayeredWindowAttributes hWndID, 0, a, LWA_ALPHA
   End If
   
   
End Sub