There is actually a few ways to do this, the main 1 being use of the APi, but if you are lookign for a sneeky alternative, u can create a custom control.
and in the custom control, use the line tool, to create a frame like border, and a caption box to create the look of the frame text..although this meathod (unless properly worked on), will not have the total funcationatie of a normal frame, but it would work fine unless you need to use a frame for anythign complecated.
There is actually a few ways to do this, the main 1 being use of the APi, but if you are lookign for a sneeky alternative, u can create a custom control.
and in the custom control, use the line tool, to create a frame like border, and a caption box to create the look of the frame text..although this meathod (unless properly worked on), will not have the total funcationatie of a normal frame, but it would work fine unless you need to use a frame for anythign complecated.
Rob
nothing complicated... but i already bound my textboxes to them lol.
So eeeermmmm cwap. There is not a colour (or better a NON colour) in the colour list present?
Thats is pretty unlucky then for me.
Hey mate Thanks for your info
I wish there was....
as i say the only other way to do it would be to use the API, there are a few tutorials on here which could help you out if you run a search on "transparent API"
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
Ok, here it comes *SLAP*
I was thinking that this was the solution, but maybe you were trying to get the frame to show through the
form to the desktop of something. Maybe you had other controls that you wanted to show through too.
So, I was too making allot of it event though I had no way to know.
Ps, this is typical Programmer thinking - anaylzing everything and anything
until it becomes complicated!
Glad to have helped you on this one
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
You can use BitBlt and some other APIs to mimic transparent frame.
Here is a sample but you'll need to work with caption a little more to make it pefect.
VB Code:
Option Explicit
Private Const BDR_SUNKENOUTER = &H2
Private Const BDR_RAISEDINNER = &H4
Private Const DT_EDITCONTROL = &H2000&
Private Const EDGE_ETCHED = (BDR_SUNKENOUTER Or BDR_RAISEDINNER)
Private Const BF_BOTTOM = &H8
Private Const BF_LEFT = &H1
Private Const BF_RIGHT = &H4
Private Const BF_TOP = &H2
Private Const BF_RECT = (BF_LEFT Or BF_TOP Or BF_RIGHT Or BF_BOTTOM)
Private Const DT_LEFT = &H0
Private Const DT_TOP = &H0
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function BitBlt Lib "gdi32" (ByVal hDCDest As Long, ByVal XDest As Long, ByVal YDest As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hDCSrc As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Declare Function DrawCaption Lib "user32" (ByVal hWnd As Long, ByVal hdc As Long, pcRect As RECT, ByVal un As Long) As Long
Private Declare Function DrawEdge Lib "user32" (ByVal hdc As Long, qrc As RECT, ByVal edge As Long, ByVal grfFlags As Long) As Long
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub Command1_Click()
'============================
Static blnTrans As Boolean
Dim MyRect As RECT
Dim X1&, Y1&, X2&, Y2&
Dim strText As String
Dim TempDC As Long
blnTrans = Not blnTrans 'toggle transparency
With Frame1
If blnTrans Then
Me.Cls
Me.ScaleMode = vbPixels
X1 = .Left - 2
Y1 = .Top - 2
X2 = X1 + .Width + 4
Y2 = Y1 + .Height + 4
SetRect MyRect, X1, Y1, X2, Y2
SetRect MyRect, X1, Y1, X2, Y2
DrawEdge Me.hdc, MyRect, EDGE_ETCHED, BF_RECT
strText = .Caption
SetRect MyRect, X1 + 10, Y1 - 5, X2, Y2
DrawText Me.hdc, strText, Len(strText), MyRect, DT_LEFT Or DT_TOP
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
in my work, the following procedures made the control reset to its original frame control:
1. clik the cmd button and make the control transparent.
2. then, make active to other windows that overlap that vb form.
3. then, go back to vb form, the control is in the original state(not transparent).
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
Welcome to the forums.
I have removed your email address from your post. Never put your email address in an open post on an open forum. Mail spam bots can pick that up and before you know it, your mailbox is full of junk mail.
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
Hello Deepa/Rhino Bull,
I tried both loading the transparent OCX and implementing the code that RB supplied, but the neither frame control method is showing as transparent. Do I need to change some system and/or VB setting to affect transparency?
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
hi Keith...
I persume that u have visited my thread at http://www.vbforums.com/showthread.php?t=399890..( from where u got the ocx)
this works just great for me..no coding.. nothing else... just change the backstyle property to transparent...
However the transparencey of the frame is seeen only at runtime
at design mode the transparent-frame ""looks-like"" normal frame
RhinoBull
You can use BitBlt and some other APIs to mimic transparent frame.
...vbcode.. etc
here i think RB's code needs to be worked independently..perhaps he did not have the ocx when the message was posted
may be both ocx.. and RB's code are not complementry to each other
try using them independtly
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
Guys,
one more time and only to clarify thigs: VB6's Frame control DOES NOT support transparency - as I said you may only mimic it by using technic similar to what i've posted. That's the end of story.
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
Hello EveryBady thes Progect Is Very simple
1. yuo can chose Stander Skin for Make Transparent
2. yuo Can chose Transparent Imge
3. yuo can chose Color Transparent
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
Originally Posted by RhinoBull
You can use BitBlt and some other APIs to mimic transparent frame.
Here is a sample but you'll need to work with caption a little more to make it pefect.
VB Code:
Option Explicit
Private Const BDR_SUNKENOUTER = &H2
Private Const BDR_RAISEDINNER = &H4
Private Const DT_EDITCONTROL = &H2000&
Private Const EDGE_ETCHED = (BDR_SUNKENOUTER Or BDR_RAISEDINNER)
Private Const BF_BOTTOM = &H8
Private Const BF_LEFT = &H1
Private Const BF_RIGHT = &H4
Private Const BF_TOP = &H2
Private Const BF_RECT = (BF_LEFT Or BF_TOP Or BF_RIGHT Or BF_BOTTOM)
Private Const DT_LEFT = &H0
Private Const DT_TOP = &H0
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function BitBlt Lib "gdi32" (ByVal hDCDest As Long, ByVal XDest As Long, ByVal YDest As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hDCSrc As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Declare Function DrawCaption Lib "user32" (ByVal hWnd As Long, ByVal hdc As Long, pcRect As RECT, ByVal un As Long) As Long
Private Declare Function DrawEdge Lib "user32" (ByVal hdc As Long, qrc As RECT, ByVal edge As Long, ByVal grfFlags As Long) As Long
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub Command1_Click()
'============================
Static blnTrans As Boolean
Dim MyRect As RECT
Dim X1&, Y1&, X2&, Y2&
Dim strText As String
Dim TempDC As Long
blnTrans = Not blnTrans 'toggle transparency
With Frame1
If blnTrans Then
Me.Cls
Me.ScaleMode = vbPixels
X1 = .Left - 2
Y1 = .Top - 2
X2 = X1 + .Width + 4
Y2 = Y1 + .Height + 4
SetRect MyRect, X1, Y1, X2, Y2
SetRect MyRect, X1, Y1, X2, Y2
DrawEdge Me.hdc, MyRect, EDGE_ETCHED, BF_RECT
strText = .Caption
SetRect MyRect, X1 + 10, Y1 - 5, X2, Y2
DrawText Me.hdc, strText, Len(strText), MyRect, DT_LEFT Or DT_TOP
Just posted a newer version of my framez control here. But its not real transparent, its fake, limited usage.
The attachment below shows the effect am trying to create. can any body help?
You can see that the frame show the color of the tabstrip (gradient) and still behaves as a container
Re: Transparent frame possible?? [resolved (on a alternative way) :)]
Originally Posted by RhinoBull
You can use BitBlt and some other APIs to mimic transparent frame.
Here is a sample but you'll need to work with caption a little more to make it pefect.
VB Code:
Option Explicit
Private Const BDR_SUNKENOUTER = &H2
Private Const BDR_RAISEDINNER = &H4
Private Const DT_EDITCONTROL = &H2000&
Private Const EDGE_ETCHED = (BDR_SUNKENOUTER Or BDR_RAISEDINNER)
Private Const BF_BOTTOM = &H8
Private Const BF_LEFT = &H1
Private Const BF_RIGHT = &H4
Private Const BF_TOP = &H2
Private Const BF_RECT = (BF_LEFT Or BF_TOP Or BF_RIGHT Or BF_BOTTOM)
Private Const DT_LEFT = &H0
Private Const DT_TOP = &H0
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function BitBlt Lib "gdi32" (ByVal hDCDest As Long, ByVal XDest As Long, ByVal YDest As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hDCSrc As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Declare Function DrawCaption Lib "user32" (ByVal hWnd As Long, ByVal hdc As Long, pcRect As RECT, ByVal un As Long) As Long
Private Declare Function DrawEdge Lib "user32" (ByVal hdc As Long, qrc As RECT, ByVal edge As Long, ByVal grfFlags As Long) As Long
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub Command1_Click()
'============================
Static blnTrans As Boolean
Dim MyRect As RECT
Dim X1&, Y1&, X2&, Y2&
Dim strText As String
Dim TempDC As Long
blnTrans = Not blnTrans 'toggle transparency
With Frame1
If blnTrans Then
Me.Cls
Me.ScaleMode = vbPixels
X1 = .Left - 2
Y1 = .Top - 2
X2 = X1 + .Width + 4
Y2 = Y1 + .Height + 4
SetRect MyRect, X1, Y1, X2, Y2
SetRect MyRect, X1, Y1, X2, Y2
DrawEdge Me.hdc, MyRect, EDGE_ETCHED, BF_RECT
strText = .Caption
SetRect MyRect, X1 + 10, Y1 - 5, X2, Y2
DrawText Me.hdc, strText, Len(strText), MyRect, DT_LEFT Or DT_TOP
MsgBox "You've just clicked transparent frame control."
End Sub
I tried this code, and it does not work. am using vb6with sp5 install on win xp
see the effcts i get in the picture below. and by the way do i have to click a button to get the effect. it does not work when doing it automatically.