设置表格MSHFlexGrid透明效果
窗体和MSHFlexGrid设置呈透明状态!但是运行时发现表格只有有数据的位置才有效果,没有数据的地方还是不透明,有什么办法解决吗?
如果没有,是不是可以这样:
将表格大小按数据多少自动调整大小来解决?高手指点下!谢谢!
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 Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H1
Private Sub Form_Load()
Me.Left = Screen.Width - Me.Width
Me.Top = 0
Me.BackColor = vbBlue
MSHFlexGrid1.BackColor = vbBlue
Dim rtn As Long
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hwnd, vbBlue, 190, LWA_ALPHA
End Sub