Hi all,
Is it possible to make the background colour of a frame transparent?
Thanks in advance
Walter
Hi all,
Is it possible to make the background colour of a frame transparent?
Thanks in advance
Walter
Last edited by waltervis; Feb 12th, 2005 at 05:29 PM.
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
Originally Posted by makster246
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"
Rob
Guys,
Thanks for help. Im gonna photoshop my way through this one. lol
Thank you very much!
Walter
Just a guess, but what about setting the frames background color to the
same as the control/form behind it? Or is there more to it then that?
VB/Office Guru™ (AKA: Gangsta Yoda™®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Star Wars Gangsta Rap • Reps & Rating Posts • VS.NET on Vista (New) • Multiple .NET Framework Versions (New) • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
Ye youre right.. but this madhead (me) wasnt looking good.Originally Posted by RobDog888
Slap me big time.
thanks mate
lol big time! hahah![]()
![]()
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.
Microsoft MVP 2006-2011
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Star Wars Gangsta Rap • Reps & Rating Posts • VS.NET on Vista (New) • Multiple .NET Framework Versions (New) • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
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 TempDC = GetDC(.hWnd) BitBlt TempDC, 0, 0, .Width, .Height, .Parent.hdc, .Left, .Top, vbSrcCopy Else Me.Cls .Refresh End If End With End Sub Private Sub Form_Load() Me.AutoRedraw = True End Sub Private Sub Frame1_Click() MsgBox "You've just clicked transparent frame control." End Sub
Last edited by RhinoBull; Feb 12th, 2005 at 07:15 PM.
Microsoft MVP - Visual Basic 2006-2013
Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database .
Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent .
The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array
Visual Basic 6.0 On-Line Documentation . Connection Strings
Very nice duplication of a frame RB! One issue is that when you mouseover the frame after the
button click it goes back to the original frame control.
VB/Office Guru™ (AKA: Gangsta Yoda™®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Star Wars Gangsta Rap • Reps & Rating Posts • VS.NET on Vista (New) • Multiple .NET Framework Versions (New) • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
Really? I works fine for me - no such effect ... hmmm ...
Microsoft MVP - Visual Basic 2006-2013
Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database .
Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent .
The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array
Visual Basic 6.0 On-Line Documentation . Connection Strings
Is there another setting that I need to apply? I just pasted the code from your post and added the controls.
I am running XP SP-1 IE 6.
VB/Office Guru™ (AKA: Gangsta Yoda™®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Star Wars Gangsta Rap • Reps & Rating Posts • VS.NET on Vista (New) • Multiple .NET Framework Versions (New) • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
Oh, wait a minute ... if you mean clicking on the button then I did that on purpose so you can toggle between transparent and regular style.
I am running XP SP2.
Microsoft MVP - Visual Basic 2006-2013
Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database .
Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent .
The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array
Visual Basic 6.0 On-Line Documentation . Connection Strings
Not exactly. I realize the command button toggles it but when its on and I move the mouse over the
transparent frame it changes back.![]()
VB/Office Guru™ (AKA: Gangsta Yoda™®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Star Wars Gangsta Rap • Reps & Rating Posts • VS.NET on Vista (New) • Multiple .NET Framework Versions (New) • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
Strange as I kept all properties to their defaults except for form's AutoRedraw which is set at run time and it works realy clean for me.
Microsoft MVP - Visual Basic 2006-2013
Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database .
Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent .
The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array
Visual Basic 6.0 On-Line Documentation . Connection Strings
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).
I think it need to redraw...
Last edited by Hack; Apr 5th, 2006 at 09:02 AM.
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.
What is your question?
Please use [Code]your code goes in here[/Code] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.
Creating A Wizard In VB.NET
Paging A Recordset
What is wrong with using On Error Resume Next
Good Article: Language Enhancements In Visual Basic 2010
Upgrading VB6 Code To VB.NET
Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
hi Walter
did u happen to get u r transparent frame.. coz.. i am also facing the same situation
please do let me know
my thread is in http://www.vbforums.com/showthread.php?t=399890
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?
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
here i think RB's code needs to be worked independently..perhaps he did not have the ocx when the message was postedRhinoBull
You can use BitBlt and some other APIs to mimic transparent frame.
...vbcode.. etc
may be both ocx.. and RB's code are not complementry to each other
try using them independtly
good luck
Deepa
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.![]()
Microsoft MVP - Visual Basic 2006-2013
Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database .
Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent .
The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array
Visual Basic 6.0 On-Line Documentation . Connection Strings
YES IT IS POSSIBLE!!!!! ..and not a fake-transparent, but a REAL transparent frame! any one who wants it can e-mail me : sokin_keso@hotmail.com
I'm working on a few inproovements and I'll distribute release 1.0 in the next days. My Transparent N-Frame will be a freeware .ocx
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
http://www.vbforums.com/attachment.p...id=52235&stc=1
Thanks a lot, dude. This works just fine for me.Originally Posted by RhinoBull
You're welcome pal.![]()
Microsoft MVP - Visual Basic 2006-2013
Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database .
Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent .
The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array
Visual Basic 6.0 On-Line Documentation . Connection Strings
Just posted a newer version of my framez control here. But its not real transparent, its fake, limited usage.