473,662 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to transparent a picturebox control in C# and show everything behind of it

mahboobeh
7 New Member
hi
i have tow picturebox and i want to show the first with a low transparency on top of the another one. its mean i want to transparent above picturebox and show every thing that behind of it like the other picturebox .how can i do this?
Oct 25 '10 #1
5 6118
GaryTexmo
1,501 Recognized Expert Top Contributor
I did some digging around and my suspicions are confirmed, you can't really do this with a PictureBox.

That said, it's pretty easy to just use a panel, set the background to transparent, then use GDI+ to draw your image yourself by overriding the OnPaint method.

Look into this and let me know it works out, or if you need some help.
Oct 25 '10 #2
mahboobeh
7 New Member
hi graytexmo
tnx for you reply.
ill put a sample here,i tried alphablend(an api) and a glassy control in this sample.
it work with glassy control but it have very low speed in compile for big pictures,
i tried yor suggestion but its great if you can give me a sample.
i hope you got what i want.
Regards.
Oct 26 '10 #3
GaryTexmo
1,501 Recognized Expert Top Contributor
I think I might be unclear on what you're looking for.

Do you want:

A) Transparency, the portion of of the control that is not taken up by the picture is completely see-through, such that you can see anything behind it.

B) Opacity, the entire control, image included, is rendered such that you can see through the image to what is behind, but the image on top is still viewable.

Your page title threw me off, I thought you meant transparency but on rereading everything in light of your latest post I'm thinking you actually meant opacity. Two different things, sorry for misunderstandin g you.

I know you can control the opacity of the form itself, but I'm not sure about individual control. An alpha blend for a large picture can indeed be a fairly expensive operation if you do it every render cycle, but you might be able to do the blend on the image, render the result, and only update on a change.

Also, are you needing the control itself to be semi-opaque, or are you just wanting to lay two pictures over top of each other?
Oct 26 '10 #4
GaryTexmo
1,501 Recognized Expert Top Contributor
Have you tried this?
http://www.codeproject.com/KB/cpp/Al...ientPanel.aspx
Oct 26 '10 #5
mahboobeh
7 New Member
tnx GaryTexmo
i used wpf usercontorl.and it worked for me.
i wnat something like image in wpf.it has an opacity in its propertis.
Oct 30 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

15
1811
by: Jose Michael Meo R. Barrido | last post by:
Hi! Can u please tech me a way to know if the image in the picturebox has changed? what event should i catch the chage?
1
3427
by: Richard Saville | last post by:
I am trying to make a transparent pictureBox. MSDN says to use this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); for the form and this.pictureBox1.BackColor = Color.Transparent; for the pictureBox I does not seem to work. I have put this pictureBox on top of another one, but its background is gray and it blocks the image. What am I doing wrong? Thanks
5
5780
by: Sharon | last post by:
I’m writing a Windows application. In the form I have a Panel and inside the panel I have a PictureBox control. I’m loading the PictureBox control with BMP image that has the following criteria: 14174 x 7874 Pixels (111.61MPixels), 1 BitsPerPixel, 3200x3200 DPI, No Compression. The memory consumption for loading this image should be 13.31 MB (13,952,776 Bytes) (this is what IrfanView takes, http://www.irfanview.com/). I’m loading...
1
3635
by: Imran Aziz | last post by:
Hello All, I have a navigation system for the site , in which the links are highlighted based on which section the site is in. Now the issue is that I do that using a class="thissection" attribute as show in the below example <li><a href="../themes/" id="n_themes" class="thissection" runat="server" >THEMES</a></li>
2
2430
by: David Ricker | last post by:
I have created a PictureBox control which can have it's Image property directly bound to an image field in a database. This works perfectly for showing the images that are in the database. When I paste a new image into my control, it shows the new image and updates the image property. Problem is... It doesn't update the bound field! Any thoughts as to what I've done wrong? Any help would be greatly appreciated. The code for the...
3
3934
by: Tyson Ackland | last post by:
Can someone tell me how you go about handling events where your window might be obscured and then when you bring it to the foreground, you want your picturebox control to be repainted instead of showing large, blocked out areas created by overlapping windows. I have seen numerous references to onpaint etc but I haven't found an example to follow or at least my own efforts with onpaint haven't been fruitful as yet.
5
4893
by: BrianW | last post by:
I am working on a program that has multiple picturebox controls that a user is allowed to move around which are contained within a panel control for visual placement. In my mousedown event, I set the picturebox control's borderstyle to Fixed3D, but upon doing so, I am not able to track the picturebox control through mousemove events (if you move the mouse off of the control too quickly, the control no longer receives mouse events). If I...
3
2014
by: ktcute | last post by:
I'm trying to write a simple drawing tool that saves images out as jpgs. I've been using the paint event on the Panel control to draw the objects, however I couldn't get the same drawing functionality when I switched to use a Picturebox control. I found that after all the objects had been painted on the control, they "disappeared". I'm wondering if this is deliberate, and if someone can suggest another way I can go about saving my...
3
12352
by: prynhart | last post by:
I have a PictureBox Control which is 96*96 pixels. I want to display nine 32*32 pixel bitmaps in this control arranged in a 3X3 square. How can I do this ? All the examples I've seen load only one image in the PictureBox. The code: board.ClientSize = new Size(96, 96); board.Image = (Image)image1;
2
6563
by: \(O\)enone | last post by:
I'm trying to create a usercontrol that is transparent, both visibly and to mouse clicks. I can make the usercontrol visibly transparent by setting the SupportsTransparentBackColor style and providing some additional processing in CreateParams and OnPaintBackground, as detailed here: http://www.codeproject.com/KB/edit/TransparentTextBox.aspx This works fine, but if I click the transparent part of my control, the
0
8435
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
8345
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
8857
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
8768
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
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
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.