Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a non transparent control transparent

Access Version or Conversion

How to make a non transparent control transparent

by  MrMoocow  Posted    (Edited  )
Here is the code

Private Const WS_EX_TRANSPARENT = &H20&
Private Const GWL_EXSTYLE = (-20)
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long



Private Function MakeWindowedControlTransparent(ctlControl As Control) As Long
Dim result As Long
ctlControl.Visible = False
result = SetWindowLong(ctlControl.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)
ctlControl.Visible = True ' Use the visible property as a quick VB way of forcing a repaint with the new style
MakeWindowedControlTransparent = result
End Function


This will make a progress bar some transparent(so the area the bar isn't shows the form)

MakeWindowedControlTransparent ProgressBar1

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top