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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transparent background on forms 2

Status
Not open for further replies.

Glohamar

Programmer
Sep 3, 2003
248
US
I have a main form with a picture set as the background and I am trying to find away to have my sub-forms background be transparent so that the backround image of my main form can be seen. Is this possible? I have right-clicked the Detail section of the form and selected transparent from the fill/backcolor with no luck. The backcolor still remains.

Thanks for any help.

Dave
 
No
But if you add the same background to each subform it may get the desired result.

DougP, MCP
 
OK. I thought so. I have an image that is tiled and when you do that to the sub-forms, the images are off when yo insert them into the main form.

Thanks for the help.
Dave
 
Hang on a second, I'm trying something and will let you know if it works.


Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Have not had any success with the layering of forms and subforms, but haven't tried using regions yet.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I appreciate the effort CajunCenturion.

Thanks
Dave
 
Good news / Bad news

The good news is that I do have forms with transparent backgrounds.

The bad news is that I'm having a little trouble right now getting the exact regions for the controls so they are not also transparent. In other words, some areas around the controls are transparent when they should not be, and some areas that should be transparent are not. The basic issue is not having direct access to individual control window handles. So I've got a little tweeking with Window regions and client regions to resolve. But I do feel at this point, given what limited success we do have, that in a little while, I'll be able to post a working solution for forms with transparent backgrounds.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
That is great CajunCenturion. I really appreciate your efforts.

Thank You
Dave
 
Here's what we have so far. It seems to work okay, with the exception of continuous forms in subforms. Need to do some more research in this area, but at least this should work in many other situations.

In a module, add the following Constants, Type Structures, and API declarations:
Code:
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
Then in the same module, add in the following Public sub.
Code:
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
Then inside the form, call the procedure sending over Me as the parameter. I'm doing it from inside of a command button, but you do it from the Form_Load as well.
Code:
Private Sub cmdMakeTrans_Click()

   MakeTransparent Me

End Sub
Well try to look into the continuous subform issue some more tomorrow (time permitting), as well as the ability to turn transparency off.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
tried this and it is really cool, but the controls and any images are cropped slightly on the right hand side and to the left of each of them is a thin strip of form the same width as that which is cropped. almost like the mask (or however youve done this) is missaligned.
but still this is a great bit of code.
 
Thanks scottian. I'm going to be fairly busy today, so probably won't have much time to spend on this. So please, if you have some time, and the desire, please feel free to contribute some fixes.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
CajunCenturion, you are great. This is some great code.

I noticed that the labels are still holding the original background, even though it is set to transparent. Am I doing something wrong? Also, can this be used with a sub-form inside of a subform? I am going to try that later to see what happens.

Thanks you for your efforts.

Dave
 
CajunCenturion, gave you a star for your efforts.

Thanks again.
Dave
 
Here is some updated code which does a few things including the following:
- Adds an additional boolean parameter which when True turns transparency on, and when False, turns transparency off.
- Skips over invisible controls so as not to expose their location
- Hopefully fixes the problem identified by scottian.
Code:
Public Sub MakeTransparent(rFrm_TheForm As Form, rBol_TransOn As Boolean)

   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
   Dim lSng_CtlValue       As Single
   Dim lSng_TwipsPixel     As Single
   Dim lSng_OneHalf        As Single
   
   lSng_TwipsPixel = CSng(15)
   lSng_OneHalf = CSng(0.5)
   
   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 + .tLng_Left
      .tLng_Bottom = .tLng_Bottom + .tLng_Top
      lLng_ClientHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
   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
      lLng_FrameHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
   End With
   
   CombineRgn lLng_FrameHandle, lLng_ClientHandle, lLng_FrameHandle, IIf((rBol_TransOn = True), RGN_XOR, RGN_OR)
   
   For Each lCtl_Control In rFrm_TheForm.Controls
      If (lCtl_Control.Visible = True) Then
         With lRct_ControlArea
            .tLng_Left = Int((CSng(lCtl_Control.Left) / lSng_TwipsPixel) + lSng_OneHalf)
            .tLng_Top = Int((CSng(lCtl_Control.Top) / lSng_TwipsPixel) + lSng_OneHalf)
            .tLng_Right = .tLng_Left + Int((CSng(lCtl_Control.Width) / lSng_TwipsPixel) + lSng_OneHalf)
            .tLng_Bottom = .tLng_Top + Int((CSng(lCtl_Control.Height) / lSng_TwipsPixel) + lSng_OneHalf)
      
            .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
      End If
   Next lCtl_Control
   
   SetWindowRgn rFrm_TheForm.hwnd, lLng_FrameHandle, True

End Sub
The label issue is a tough one, at least with this approach to the transparency issue, and that will require some thinking. Also, still have the continuous subform issue to deal with.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
One more update - this takes care of continuous sub-forms. Although, I cannot guarantee that it will work in all cases, and it may require some tweeking.
Code:
Public Sub MakeTransparent(rFrm_TheForm As Form, rBol_TransOn As Boolean)

   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
   Dim lSng_CtlValue             As Single
   Dim lSng_TwipsPixel           As Single
   Dim lSng_OneHalf              As Single
   Dim lLng_DetailHeight         As Long
   Dim lLng_DetailTop            As Long
   Dim lLng_FooterTop            As Long
   Dim lBol_ContinuousForm       As Boolean
   Dim lLng_ContinuousTop        As Long
   Dim lLng_ContinuousLeft       As Long
   Dim lLng_ContinuousBottom     As Long
   Dim lLng_ContinuousRight      As Long
   Dim lLng_RecordHeight         As Long
   Dim lLng_MaxHeight            As Long
   Dim lLng_RecSecWidth          As Long
   Dim lLng_VertScrollBarWidth   As Long
   Dim lLng_HorzScrollBarHeight  As Long
   Dim lLng_StdRecSelWidth       As Long
   Dim lLng_StdScrollBarWidth    As Long
   Dim llng_StdScrollBarHeight   As Long
Code:
' The following four settings may require adjustment depending
' on your machine, screen resolutions, and the like.  They
' represent the Pixel width of the RecordSelector Column,
' the pixel width of the Vertical Scroll Bar, and the pixel
' height of the horizontal scroll bar.  The code will take
' into account whether or not they are included on the form.
Code:
   lLng_StdRecSelWidth = 20
   lLng_StdScrollBarWidth = 20
   llng_StdScrollBarHeight = 20
   lSng_TwipsPixel = CSng(15)
   lSng_OneHalf = CSng(0.5)
 
   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 + .tLng_Left
      .tLng_Bottom = .tLng_Bottom + .tLng_Top
      lLng_ClientHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
   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
      lLng_FrameHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
   End With
   
   CombineRgn lLng_FrameHandle, lLng_ClientHandle, lLng_FrameHandle, IIf((rBol_TransOn = True), RGN_XOR, RGN_OR)
   DeleteObject lLng_ClientHandle
   
   On Error Resume Next
   lLng_DetailTop = Int((CSng(rFrm_TheForm.Section(acHeader).Height) / lSng_TwipsPixel) + lSng_OneHalf)
   On Error GoTo 0

   lBol_ContinuousForm = (rFrm_TheForm.DefaultView = 1)
   lLng_DetailHeight = Int((CSng(rFrm_TheForm.Section(acDetail).Height) / lSng_TwipsPixel) + lSng_OneHalf)
   lLng_RecordHeight = lLng_DetailHeight
   If (rFrm_TheForm.RecordSource <> vbNullString) Then
      If (rFrm_TheForm.Recordset.RecordCount > 0) Then
         If (rFrm_TheForm.AllowAdditions = True) Then
            lLng_RecordHeight = lLng_DetailHeight * (rFrm_TheForm.Recordset.RecordCount + 1)
         Else
            lLng_RecordHeight = lLng_DetailHeight * rFrm_TheForm.Recordset.RecordCount
         End If
      End If
   End If
   lLng_FooterTop = lLng_DetailTop + lLng_RecordHeight
   lLng_RecSecWidth = IIf((rFrm_TheForm.RecordSelectors = True), lLng_StdRecSelWidth, 0)
   lLng_VertScrollBarWidth = IIf((rFrm_TheForm.ScrollBars > 1), lLng_StdScrollBarWidth, 0)
   lLng_HorzScrollBarHeight = IIf((rFrm_TheForm.ScrollBars = 1 Or rFrm_TheForm.ScrollBars = 3), llng_StdScrollBarHeight, 0)
   
   lLng_ContinuousTop = 9999
   lLng_ContinuousLeft = 9999
   For Each lCtl_Control In rFrm_TheForm.Controls
      If (lCtl_Control.Visible = True) Then
         With lRct_ControlArea
               Select Case lCtl_Control.Section
                  Case acHeader
                     .tLng_Top = 0
                  Case acDetail
                     .tLng_Top = lLng_DetailTop
                  Case acFooter
                     .tLng_Top = lLng_FooterTop
               End Select
            .tLng_Left = Int((CSng(lCtl_Control.Left) / lSng_TwipsPixel) + lSng_OneHalf)
            .tLng_Top = .tLng_Top + Int((CSng(lCtl_Control.Top) / lSng_TwipsPixel) + lSng_OneHalf)
            .tLng_Right = .tLng_Left + Int((CSng(lCtl_Control.Width) / lSng_TwipsPixel) + lSng_OneHalf)
            .tLng_Bottom = .tLng_Top + Int((CSng(lCtl_Control.Height) / lSng_TwipsPixel) + lSng_OneHalf)

            If ((lCtl_Control.Section = acDetail) And (lBol_ContinuousForm = True)) Then
               If (.tLng_Top < lLng_ContinuousTop) Then
                  lLng_ContinuousTop = .tLng_Top
               End If
               If (.tLng_Left < lLng_ContinuousLeft) Then
                  lLng_ContinuousLeft = .tLng_Left
               End If
               If (.tLng_Right > lLng_ContinuousRight) Then
                  lLng_ContinuousRight = .tLng_Right
               End If
               If (.tLng_Bottom > lLng_ContinuousBottom) Then
                  lLng_ContinuousBottom = .tLng_Bottom
               End If
            Else
               .tLng_Left = lLng_RecSecWidth + .tLng_Left + lRct_ClientArea.tLng_Left
               .tLng_Top = .tLng_Top + lRct_ClientArea.tLng_Top
               .tLng_Right = lLng_RecSecWidth + .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)
               CombineRgn lLng_FrameHandle, lLng_FrameHandle, lLng_CntlHandle, RGN_OR
               DeleteObject lLng_CntlHandle
            End If
         End With
      End If
   Next lCtl_Control

   If (lBol_ContinuousForm = True) Then
      With lRct_ControlArea
         .tLng_Left = lLng_RecSecWidth + lLng_ContinuousLeft + lRct_ClientArea.tLng_Left
         .tLng_Top = lLng_ContinuousTop + lRct_ClientArea.tLng_Top
         .tLng_Right = lLng_RecSecWidth + lLng_ContinuousRight + lRct_ClientArea.tLng_Left
         .tLng_Bottom = lLng_RecordHeight + lLng_ContinuousTop + lRct_ClientArea.tLng_Top
         lLng_MaxHeight = Int((CSng(rFrm_TheForm.InsideHeight) / lSng_TwipsPixel) + lSng_OneHalf)
         If (.tLng_Bottom > lLng_MaxHeight) Then
            .tLng_Bottom = lLng_MaxHeight
         End If
         lLng_CntlHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
         CombineRgn lLng_FrameHandle, lLng_FrameHandle, lLng_CntlHandle, RGN_OR
         DeleteObject lLng_CntlHandle
      
         If (lLng_RecSecWidth > 0) Then
            .tLng_Left = lLng_ContinuousLeft + lRct_ClientArea.tLng_Left
            .tLng_Right = lLng_ContinuousLeft + lLng_RecSecWidth + lRct_ClientArea.tLng_Left
            lLng_CntlHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
            CombineRgn lLng_FrameHandle, lLng_FrameHandle, lLng_CntlHandle, RGN_OR
            DeleteObject lLng_CntlHandle
         End If
      
         If (lLng_RecSecWidth > 0) Then
            .tLng_Left = lLng_ContinuousLeft + lRct_ClientArea.tLng_Left
            .tLng_Right = lLng_ContinuousLeft + lLng_RecSecWidth + lRct_ClientArea.tLng_Left
            lLng_CntlHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
            CombineRgn lLng_FrameHandle, lLng_FrameHandle, lLng_CntlHandle, RGN_OR
            DeleteObject lLng_CntlHandle
         End If
         
         If (lLng_VertScrollBarWidth > 0) Then
            .tLng_Top = 0
            .tLng_Left = lLng_ContinuousRight + lLng_RecSecWidth + lRct_ClientArea.tLng_Left
            .tLng_Right = .tLng_Left + lLng_VertScrollBarWidth
            .tLng_Bottom = lLng_MaxHeight
            lLng_CntlHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
            CombineRgn lLng_FrameHandle, lLng_FrameHandle, lLng_CntlHandle, RGN_OR
            DeleteObject lLng_CntlHandle
         End If
         
         If (lLng_HorzScrollBarHeight > 0) Then
            .tLng_Top = lLng_MaxHeight
            .tLng_Left = 0
            .tLng_Right = lLng_ContinuousRight + lLng_RecSecWidth + lLng_VertScrollBarWidth + lRct_ClientArea.tLng_Left
            .tLng_Bottom = .tLng_Top + lLng_HorzScrollBarHeight
            lLng_CntlHandle = CreateRectRgn(.tLng_Left, .tLng_Top, .tLng_Right, .tLng_Bottom)
            CombineRgn lLng_FrameHandle, lLng_FrameHandle, lLng_CntlHandle, RGN_OR
            DeleteObject lLng_CntlHandle
         End If
     
      End With
   End If
 
   SetWindowRgn rFrm_TheForm.hwnd, lLng_FrameHandle, True
   DeleteObject lLng_FrameHandle

End Sub
Obviously, this code contains no warranties, and I have not tested all combinations of scroll bars, navigation options, record selectors, and other form options.

Any and all persons who wish to add (or correct) this code are more than welcome to do so, and please post updates and suggestions as together we can put together a nice routine.

A nice challenge for someone for someone would be to develop the code to merge regions across forms, thus allowing transparency to pass through multiple form layers.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Are you asking how to use an image as a background on a form?
if so, open the form in design view and just copy and paste the image, then from the format menu select send to back

Be ALERT - Your country needs Lerts
 
Or, goto the properties of the form, format tab and find Picture. It should say (none). Click the three dot button at the end and find your picture you want for a background. The other options are for tiling if the picture does not fill the whole form background.

Dave
 
can anyone spot why this code wont work for me?
the first peice did but the two updates didnt for some reason, i get the error
&quot;event proceduredeclaration does not match description of event having the same name&quot;

also, is there a way to set only one color to be transparent?

Be ALERT - Your country needs Lerts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top