1 Attachment(s)
How to make a picturebox transparent
Here's a technique that I worked out to make a picturebox see thru.
Layered windows are considered the top most window with no parent - but if you take a picturebox set it's parent to zero you can make it transparent then set the form as it's parent again. you must refresh immediately to lock the graphics. the drawback is that the coordinates are now screen coordinates but I use ClientToScreen and a timer to keep it aligned.
1 Attachment(s)
Re: How to make a picturebox transparent
And here's a usercontrol example:
Re: How to make a picturebox transparent
Your links are dead. Can you pls correct them?
Re: How to make a picturebox transparent
Here, I uploaded them to the post, wonder what happened to that thread?
Re: How to make a picturebox transparent
1 Attachment(s)
Re: How to make a picturebox transparent
Quote:
Originally Posted by
technorobbo
Here, I uploaded them to the post, wonder what happened to that thread?
Hello Thanks for the quick respons!
But i wanted a transparent picturebox to solve the problem i was having.
I had a tabstrip control in xp style but the frame control is not transparent.
So i thot if i could make either the frame or picture box transparent , it will do just fine.
i have search for transparent picture and frame, but its either to complex (as use of like three four modules ) or it has a bug
when i use ur solution, it does not get transparent when i put controls on the picture box
i have attached the effect am trying to emulate. the winxp system diloge box
any ideas
thanks once again
Re: How to make a picturebox transparent
I'm not clear from the image what is transparent, are you trying to grey out a button?
Re: How to make a picturebox transparent
Quote:
Originally Posted by
technorobbo
I'm not clear from the image what is transparent, are you trying to grey out a button?
From the image you'll see that the frame control with blue text is transparent (ie the gradient of the tabstrip show through, just like a transparent label control)
Re: How to make a picturebox transparent
Hey your right, I never noticed that before - but that dialog is a layered top level window, not a control and making those semi-transparent is easy. It's the windows control like a picturebox that takes some effort.
Here - Make form, put a bunch of controls in it and put this code in it.
Code:
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal CRef As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2&
Dim OldStyle As Long
Private Sub Form_Load()
OldStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
Me.Show
Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED)
Call SetLayeredWindowAttributes(Me.hwnd, 0, 128, LWA_ALPHA)
End Sub
It and all it's controls will be see thru.
Change the 128 to 240 and it will be slightly transparent.
Re: How to make a picturebox transparent
This is making the whole form transparent
I just want the picture box made transparent or translucent. this means it still acts as a container, but will host controls because am using it with a tabstrip see the attached picture.
or if you can make the frame control transparent better
Re: How to make a picturebox transparent
A User Control Can be used as a container and has a tranpsparent background. Have you tried using that? If you only want to use it as a container it may be perfect for your needs.
Re: How to make a picturebox transparent
ok help me with some code
Re: How to make a picturebox transparent
Sure - what's going in the container?
Here's a quick example - the only issue with usercontrols is that transparent labels disappear but here's an easy work around:
http://home.comcast.net/~technorobbo/FrameTrans.zip
Stay away from Arial because TrueType Fonts look a little sloppy. Stick with Bitmap Fonts Like MS Sans Serif.
Re: How to make a picturebox transparent
i'ltry this one out.thanks