473,698 Members | 2,281 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 8780
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
4115
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
3337
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
2540
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
8676
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
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9161
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
8867
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
7732
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
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
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.