Transparent Frames-- possible??? 
Author Message
 Transparent Frames-- possible???

Here one I can't find figure out or find guidance through Google:

Is/are there any API call(s) that can force the standard VB Frame control to
be transparent against the form background?

...Rad
RAD Software
http://www.*-*-*.com/ ~radsoftware



Thu, 04 Aug 2005 00:56:05 GMT  
 Transparent Frames-- possible???

Quote:
> Here one I can't find figure out or find guidance through Google:

> Is/are there any API call(s) that can force the standard VB Frame
control to
> be transparent against the form background?

From a previous post of mine:

I'm sure there must be a "cleaner" solution to this; but until someone
posts it, this will have to do. Add a Module to your project
(Project/AddModule from VB's menu) and paste the code at the end of this
message into it. To use it, simply call its Sub with the Frame (actually
any container including the Form itself) as the argument like so

     MakeContainerTransparent Frame1

assuming your frame is named Frame1. All controls on the container will
show up but the container itself won't. There is a downside to this
method. OptionButtons, CheckBoxes and Labels will have the background
color of their text portion show; you can't make them transparent using
the method I show below. However, this does make it easier to read their
text if a solid background it behind them. If you use a "clever" color
scheme for the text and the background, you can make them fit
attractively over the underlying image.

Rick - MVP

Private Type POINTAPI
  X As Long
  Y As Long
End Type

Private Declare Function CreateRectRgn _
                Lib "gdi32" _
               (ByVal X1 As Long, _
                ByVal Y1 As Long, _
                ByVal X2 As Long, _
                ByVal Y2 As Long) _
                As Long

Private Declare Function CreatePolygonRgn _
                Lib "gdi32" _
               (lpPoint As POINTAPI, _
                ByVal nCount As Long, _
                ByVal nPolyFillMode As Long) _
                As Long

Private Declare Function CombineRgn _
                Lib "gdi32" _
               (ByVal hDestRgn As Long, _
                ByVal hSrcRgn1 As Long, _
                ByVal hSrcRgn2 As Long, _
                ByVal CombineMode As Long) _
                As Long

Private Declare Function SetWindowRgn _
                Lib "user32" _
               (ByVal hWnd As Long, _
                ByVal hRgn As Long, _
                ByVal bRedraw As Long) _
                As Long

Private Declare Function DeleteObject _
                Lib "gdi32" _
               (ByVal hObject As Long) _
                As Long

Private Const RGN_OR = 2
Private Const ALTERNATE = 1

Public Sub MakeContainerTransparent(TheContainerObject As Object)
  Dim TPPx As Long
  Dim TPPy As Long
  Dim Ctrl As Control
  Dim CtrlShape(3) As POINTAPI
  Dim ComboReg As Long
  Dim TempReg As Long
  Dim ReturnVal As Long
  Dim ContainObj As Object
  Dim NotFirstControl As Boolean
  If TypeOf TheContainerObject Is Form Then
    Set ContainObj = TheContainerObject
  Else
    Set ContainObj = TheContainerObject.Parent
  End If
  TPPx = Screen.TwipsPerPixelX
  TPPy = Screen.TwipsPerPixelY
  For Each Ctrl In ContainObj.Controls
    If Ctrl.Container Is TheContainerObject Then
      With Ctrl
        CtrlShape(0).X = .Left \ TPPx
        CtrlShape(0).Y = .Top \ TPPy
        CtrlShape(1).X = (.Left + .Width) \ TPPx
        CtrlShape(1).Y = .Top \ TPPy
        CtrlShape(2).X = (.Left + .Width) \ TPPx
        CtrlShape(2).Y = (.Top + .Height) \ TPPy
        CtrlShape(3).X = .Left \ TPPx
        CtrlShape(3).Y = (.Top + .Height) \ TPPy
        If NotFirstControl Then
          TempReg = CreatePolygonRgn&(CtrlShape(0), 4&, ALTERNATE)
          ReturnVal = CombineRgn(ComboReg, ComboReg, TempReg, RGN_OR)
          DeleteObject TempReg
        Else
          ComboReg = CreatePolygonRgn&(CtrlShape(0), 4&, ALTERNATE)
          NotFirstControl = True
        End If
      End With
    End If
  Next
  Set Ctrl = Nothing
  Set ContainObj = Nothing
  SetWindowRgn TheContainerObject.hWnd, ComboReg, True
  DeleteObject ComboReg
End Sub



Thu, 04 Aug 2005 01:42:02 GMT  
 Transparent Frames-- possible???

Alternatively use a UserControl

Quote:

>Here one I can't find figure out or find guidance through Google:

>Is/are there any API call(s) that can force the standard VB Frame control to
>be transparent against the form background?

>...Rad
>RAD Software
>http://bigfoot.com/~radsoftware



Thu, 04 Aug 2005 18:49:18 GMT  
 Transparent Frames-- possible???

Quote:

> Is/are there any API call(s) that can force
> the standard VB Frame control to
> be transparent against the form background?

* * Please include a copy of this note with your reply

        Jeff Bennett      

        Bennet-Tec Information Systems, Inc  
        50 Jericho Tpk, Jericho, NY 11753
        Phone 516 997 5596,  Fax - 5597
        WWW.Bennet-Tec.Com  

        ActiveX Controls : TList/Pro  * ALLText HT/Pro * MetaDraw  
        and Custom Software Development Services

======================  ======================



Fri, 05 Aug 2005 11:30:26 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Making Radio Buttons, check boxes , and Frames Transparent

2. Transparent frames?

3. Transparent Frames

4. Transparent frames

5. Transparent Frames ???

6. Transparent Frames/Picture Box Containers

7. Make Frames and other controls transparent

8. Transparent Frames

9. Transparent Frames

10. Transparent Frames

11. is it possible to manage broswer frames in vbscript

12. Transparent frames... possible?

 

 
Powered by phpBB® Forum Software