Dear kjv1611:
Not at all what I had in mind. I wanted to programatically find the value of the main Access window. Then I could apply it to a form that I wanted to appear "transparent" and it would work independent of individual system color settings. There was an example by Lebans however, it was over my head. The closest thing I have found is an example of an actual transparent form, which I have included below. The detail section is transparent while the controls remain in their original state. I am sorry that I don't recall where I found it to give proper credit to the author.
So, I do believe that this is a VBA question, having to deal directly with API calls for finding the backcolor of the main window. I hope that you all enjoy the attachment, it worked quite nicely for me.
Thank you,
Barry
Here is the code: Call the function MakeTransparent(FormName)
Option Compare Database
Option Explicit
Public Const RGN_AND = 1
Public Const RGN_COPY = 5
Public Const RGN_DIFF = 4
Public Const RGN_OR = 2
Public Const RGN_XOR = 3
Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Public Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Type POINTAPI
tLng_Xloc As Long
tLng_YLoc As Long
End Type
Public Type RECT
tLng_Left As Long
tLng_Top As Long
tLng_Right As Long
tLng_Bottom As Long
End Type
Public Sub MakeTransparent(rFrm_TheForm As Form)
Dim lCtl_Control As Control
Dim lRct_WinFrame As RECT
Dim lRct_ClientArea As RECT
Dim lRct_ControlArea As RECT
Dim lPnt_TopLeft As POINTAPI
Dim lPnt_BottRight As POINTAPI
Dim lLng_CntlHandle As Long
Dim lLng_ClientHandle As Long
Dim lLng_FrameHandle As Long
GetWindowRect rFrm_TheForm.hwnd, lRct_WinFrame
GetClientRect rFrm_TheForm.hwnd, lRct_ClientArea
lPnt_TopLeft.tLng_Xloc = lRct_WinFrame.tLng_Left
lPnt_TopLeft.tLng_YLoc = lRct_WinFrame.tLng_Top
lPnt_BottRight.tLng_Xloc = lRct_WinFrame.tLng_Right
lPnt_BottRight.tLng_YLoc = lRct_WinFrame.tLng_Bottom
ScreenToClient rFrm_TheForm.hwnd, lPnt_TopLeft
ScreenToClient rFrm_TheForm.hwnd, lPnt_BottRight
With lRct_WinFrame
.tLng_Left = lPnt_TopLeft.tLng_Xloc
.tLng_Top = lPnt_TopLeft.tLng_YLoc
.tLng_Right = lPnt_BottRight.tLng_Xloc
.tLng_Bottom = lPnt_BottRight.tLng_YLoc
End With
With lRct_ClientArea
.tLng_Left = Abs(lRct_WinFrame.tLng_Left)
.tLng_Top = Abs(lRct_WinFrame.tLng_Top)
.tLng_Right = .tLng_Right + Abs(lRct_WinFrame.tLng_Left)
.tLng_Bottom = .tLng_Bottom + Abs(lRct_WinFrame.tLng_Top)
End With
With lRct_WinFrame
.tLng_Right = .tLng_Right + Abs(.tLng_Left)
.tLng_Bottom = .tLng_Bottom + Abs(.tLng_Top)
.tLng_Top = 0
.tLng_Left = 0
End With
With lRct_ClientArea
lLng_ClientHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
End With
With lRct_WinFrame
lLng_FrameHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
End With
CombineRgn lLng_FrameHandle, lLng_ClientHandle, lLng_FrameHandle, RGN_XOR
For Each lCtl_Control In rFrm_TheForm.Controls
lRct_ControlArea.tLng_Left = lCtl_Control.Left \ 15
lRct_ControlArea.tLng_Top = lCtl_Control.Top \ 15
lRct_ControlArea.tLng_Right = (lCtl_Control.Left + lCtl_Control.Width - 15) \ 15
lRct_ControlArea.tLng_Bottom = (lCtl_Control.Top + lCtl_Control.Height - 15) \ 15
With lRct_ControlArea
.tLng_Left = .tLng_Left + lRct_ClientArea.tLng_Left
.tLng_Top = .tLng_Top + lRct_ClientArea.tLng_Top
.tLng_Right = .tLng_Right + lRct_ClientArea.tLng_Left
.tLng_Bottom = .tLng_Bottom + lRct_ClientArea.tLng_Top
lLng_CntlHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
End With
CombineRgn lLng_FrameHandle, lLng_CntlHandle, lLng_FrameHandle, RGN_OR
Next lCtl_Control
SetWindowRgn rFrm_TheForm.hwnd, lLng_FrameHandle, True
End Sub