473,702 Members | 2,325 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

making image and picturebox transparent

in my app i must have several pictureboxes over the others. Some pictureboxes
just have a couple of lines or rectangles, and absolutly nothing more but the
image is an .BMP. So, my problem is that i need to see whats beind those
pictureboxes and at the same time showing, the lines and rectangles that
exist on the pictureboxes that are at the top. Because i just can't copy the
image to the other picturebox (because i'll have to be able to control that
image, later) i need to know how can i turn transparant the pictureboxes that
are at the top. I've tryed the following code but it didn't work because what
it does is to copy the background color of the main picturebox to the
picturebox at the top

dim Logo as new Bitmap(CompanyL ogo.Image)
Logo.MakeTransp arent(Logo.GetP ixel(1,1))
CompanyLogo.Ima ge=Logo;

Nov 21 '05 #1
1 8782
Hi,

The picturebox does not have a transparent color property. I
would use a form instead.

Dim frm As Form

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
PictureBox1.Bac kgroundImage = Image.FromFile( "C:\bliss.b mp")
End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim bm As New Bitmap(PictureB ox1.Width, PictureBox1.Hei ght)
Dim g As Graphics = Graphics.FromIm age(bm)
g.Clear(Color.W hite)
g.FillEllipse(B rushes.Red, 20, 20, 20, 20)
bm.MakeTranspar ent(Color.White )
g.Dispose()
frm = New Form
With frm
.FormBorderStyl e = FormBorderStyle .None
.Size = PictureBox1.Siz e
.TopLevel = False
.Parent = PictureBox1
.BringToFront()
.TransparencyKe y = SystemColors.Co ntrol
.BackgroundImag e = bm
.Show()
End With
End Sub

Ken
-----------------
"Ricardo Furtado" <Ri************ @discussions.mi crosoft.com> wrote in
message news:16******** *************** ***********@mic rosoft.com...
in my app i must have several pictureboxes over the others. Some
pictureboxes
just have a couple of lines or rectangles, and absolutly nothing more but
the
image is an .BMP. So, my problem is that i need to see whats beind those
pictureboxes and at the same time showing, the lines and rectangles that
exist on the pictureboxes that are at the top. Because i just can't copy
the
image to the other picturebox (because i'll have to be able to control
that
image, later) i need to know how can i turn transparant the pictureboxes
that
are at the top. I've tryed the following code but it didn't work because
what
it does is to copy the background color of the main picturebox to the
picturebox at the top

dim Logo as new Bitmap(CompanyL ogo.Image)
Logo.MakeTransp arent(Logo.GetP ixel(1,1))
CompanyLogo.Ima ge=Logo;

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6846
by: Leonard Challis | last post by:
Good morning everyone I am currently doing quite a large project in VB6 and ACCESS for college, for a Photographers company assignment. I am posting here to see if anyone has any advice on what I might want to try to counter the problems I seem to be facing... The only area of the project I am struggling on is the graphical side. Basically, I need to take in a load of large photographs, create a thumbnail for each, create a preview...
1
4116
by: Robert W. | last post by:
In my Winforms app I'm trying to get an image's background to appear transparent on a form that has a gradient background. So I added a PictureBox and then attempted to add a custom paint command for the PictureBox. But it's not working. Here's the code I've written: public void InitializeLinearGradients() { this.Paint += new PaintEventHandler(PaintClient); this.SizeChanged += new EventHandler(SizeClient); pictureLogo.Paint += new...
18
7442
by: Andrew Christiansen | last post by:
Hey all. The images I create in photoshop with semi-transparent pixels (for instance in Photoshop text with a dropshadow with a transparent canvas) I've been saving in PNG format and then using them in my VB.NET app using the picturebox control. I was really happy when I learned that you could use PNG images in VB.NET so your images could blend in with the form's background color. But, is PNG the ideal image format to use with these...
1
3342
by: M West | last post by:
continuation of my previous post, thanks to all those that contributed with answers I am creating a control that will take an image and make parts of it transparent, this is done by creating and then applying a region to the control. The control inherits from picturebox and works fine when loading the image into the control, the problem that I am having now is, once the control is loaded and the image is displayed, if the user resizes...
5
2541
by: Tony Clark | last post by:
Hi, I have a bmp that is set in a panel, i want to make the white color in the bmp image transparent so i can see the color of the panel below. How is this done? thanks tony
7
1775
by: G .Net | last post by:
Hi I have a form on which I have a picture box. I have placed a GIF as the image for this picture box. The GIF has a transparent background. If I change the background color of the form, then the GIF appears on the form correctly i.e. the background of the form shows through the transparent part of the gif. However, if I place a BackgroundImage on the form, the transparent part of
4
1483
by: rodchar | last post by:
hey all, i have an image that i want to put on my form and was just wondering if there is a way to take away the white background on the image (make it transparent)? thanks, rodchar
4
13462
by: =?Utf-8?B?S3VsYmVy?= | last post by:
First off, excuse my English, is an online translation. Hello. I've been looking for a long time over the Internet how to make a "textbox" is transparent or having a background image, but I can not find, just a website that allows a "textbox" is transaprente, but is in C (and not I have no idea C). The Web is this: http://www.codeproject.com/KB/edit/TransparentTextBox.aspx I think that is an interesting feature that microsoft has not...
8
3946
by: Linsolv | last post by:
I have seen many similar questions to mine, and I think I might have found one that was almost the same, but none of the solutions worked that I found. I have a C# Windows form application, with an image over an image; If the top image were rectangular, this would work fine. But the problem is, it's not, and the top image is taking up too much space with it's "control" colored background. I can make the background of the top image...
0
8739
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9234
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9089
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8983
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8940
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2036
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.