How do I make a picture transparent in Paintshop Pro 7 or VB6 so that when I add image and put the picture, the background will show behind it?
Printable View
How do I make a picture transparent in Paintshop Pro 7 or VB6 so that when I add image and put the picture, the background will show behind it?
I have paint shop pro, when you create your "new image" set the background to transparent. then save your image.
When you place it in VB you have to put it in an "Image box"
DONT USE A PICTURE BOX OR THE BACKGROUND WILL NEVER SHOW UP TRANSPARENT.
Thats it. If you have more questions about "Paint Shop Pro" I can help you out with that to. Let me know.
Doc
If you have to use a PictureBox then there is a technique called Regioning which will allow you to turn the PictureBox into a funny shape, thus allowing you to cut around the image, simulating transparency. But as Doc_loveless said the Image control is easier to use. It just lacks some of the functionality of the PictureBox.
When i put it as transparent when i click new image, can i paste the pic in there? Im not making any images... Here is the image i have : I was going to cut each pic out, for example, im making a browser, so i was going to cut out the back arrow and put it in vb but that pink bg comes up. Just wondering how do you do that "Regioning" thing?
To use Regioning make a picture box without a border (BorderStyle=0) and paste your image in there.
Here's a demo showing the code you need to turn it into a nice circular picturebox. It works by taking the colour of the 1st pixel of the image (at 0,0) as the background colour and then cutting that colour from the outside of the image; so it's pretty flexible in that you can paste an image with any colour in. Even pink. :D
penagate,
Nice example.
However, I would like to do the reverse; make the central part transparent.
I need to use the picturebox control in order to utilise its drawing functions ability to contain a shape.
What I would like to do is to round off the corners of a webbrowser control.
At the moment I've placed a picturebox over the webbrowser control and am using the Rounded Rectangle Shape to define the area I want visible. I am now trying to make the area contained in the Rounded Rectangle transparent, leaving the corners opaque.
Any suggestions how to that?
Cheers,
Nap
@Napoleon,
You can do so without regioning - by using a transparent usercontrol instead.
1. Create a UserControl.
2. Set it's ControlContainer = True and BackStyle = Transparent
3. FILL the usercontrol with a Rounded Rectangle shape. (For smoother effect,set the Shape's BorderStyle to Transparent.)
4. Set the shape's FillStyle to Solid.
5. Now use this user control as the container of your WebBrowser Cotrol.
PS. It is better idea to create a new thread (with link to the original one) rather than digging up an old one. :)
(Possibly CodeBank threads are only exceptions)
Hey guys, just a question. Whenever I make a picture with transparent background, the transparent always comes out as black, not pink like the examples in here, and when I put it in an image list it's still black. How can I make my images with transparent bg?
Encoder, this thread is 4 years old. Suggest you start your own thread and supply pertinent details as to how you are creating your bitmaps/images and how you are loading them
This is 14 years old..
To make something transparent for loading a .gif with a specific background color, such as Magenta, all form elements that have a magenta BackColor will become transparent.
Code:Option Explicit
Private Const LWA_COLORKEY As Long = 1
Private Const WS_EX_LAYERED As Long = &H80000
Private Const GWL_EXSTYLE As Long = -20
Private Declare Function SetLayeredWindowAttributes Lib "user32" ( _
ByVal hWnd As Long, _
ByVal crKey As Long, _
ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Boolean
Private Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongW" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongW" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Private Sub Form_Load()
SetWindowLong Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes Me.hWnd, vbMagenta, 0, LWA_COLORKEY
End Sub