473,386 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Grphics: How to draw an image transparent

Hi,

I have an Image that is drawn with Graphics.DrawImage(..). What I want
to do is drawing it with a given transparency, e.g. at an alpha of only
180 instead of 255.

How am I doing that?!?!?

Regards,
Felix
Nov 16 '05 #1
6 3972
Read the Beginners Guide to GDI+.

Google for it...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"felix" <fe***@news.com> wrote in message
news:ut**************@TK2MSFTNGP15.phx.gbl...
Hi,

I have an Image that is drawn with Graphics.DrawImage(..). What I want to
do is drawing it with a given transparency, e.g. at an alpha of only 180
instead of 255.

How am I doing that?!?!?

Regards,
Felix

Nov 16 '05 #2
The info you need is actually in the GDI+ FAQ. See the article on Drawing
images.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"felix" <fe***@news.com> wrote in message
news:ut**************@TK2MSFTNGP15.phx.gbl...
Hi,

I have an Image that is drawn with Graphics.DrawImage(..). What I want to
do is drawing it with a given transparency, e.g. at an alpha of only 180
instead of 255.

How am I doing that?!?!?

Regards,
Felix

Nov 16 '05 #3
Actually, I can't find such an information on your website. I know how
to draw an image and I'm also able to draw a transparent gif (well, I
think, GDI+ simply handles the transparency on its own).

What I want is to render the entire image (regardless of its own
transparency) with a specific alpha. Imagine a slider where the user can
modify the alpha value in the range [0,255] and the image will be
rendered accordingly.

I can't find any information about that issue. Thus, I'm really looking
forward for any help I can get.

Regards,
Felix

Bob Powell [MVP] wrote:
The info you need is actually in the GDI+ FAQ. See the article on Drawing
images.

Nov 16 '05 #4
Actually, I can't find such an information on your website. I know how
to draw an image and I'm also able to draw a transparent gif (well, I
think, GDI+ simply handles the transparency on its own).

What I want is to render the entire image (regardless of its own
transparency or file-format / pixel-format) with a specific alpha.
Imagine a slider where the user can modify the alpha value in the range
[0,255] and the image will be rendered accordingly.

I can't find any information about that issue. Thus, I'm really looking
forward for any help I can get.

Regards,
Felix
Bob Powell [MVP] wrote:
The info you need is actually in the GDI+ FAQ. See the article on Drawing
images.

Nov 16 '05 #5
At the bottom of the Drawing An Image article in the GDI+ FAQ it clearly
shows how to draw an image with transparency using the ColorMatrix
structure.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"felix" <fe***@news.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Actually, I can't find such an information on your website. I know how to
draw an image and I'm also able to draw a transparent gif (well, I think,
GDI+ simply handles the transparency on its own).

What I want is to render the entire image (regardless of its own
transparency or file-format / pixel-format) with a specific alpha. Imagine
a slider where the user can modify the alpha value in the range [0,255]
and the image will be rendered accordingly.

I can't find any information about that issue. Thus, I'm really looking
forward for any help I can get.

Regards,
Felix
Bob Powell [MVP] wrote:
The info you need is actually in the GDI+ FAQ. See the article on Drawing
images.

Nov 16 '05 #6
Oops, I didn't see the very last example. I'm really sorry.

Everything works fine now -- THANK YOU!

Regards,
Felix
Bob Powell [MVP] wrote:
At the bottom of the Drawing An Image article in the GDI+ FAQ it clearly
shows how to draw an image with transparency using the ColorMatrix
structure.

Nov 16 '05 #7

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

Similar topics

21
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
1
by: Minhua Fu | last post by:
Hi, I have a problem when I draw a transparent gif picture. I have an existing transparent gif picture, i want to modify the gif and save it to reponse.outstream. But the picture always keep...
4
by: Adam Clauss | last post by:
I have a completely user-drawn user control in which I enabled transparency (follownig suggestions at...
2
by: Niu Kun | last post by:
Dear all, I'm trying to draw many overlapped PNG files with transparent background in imagebox control. But the transparent background in this control is rendered as the main control's...
3
by: NickP | last post by:
Hi there, I have a usercontrol that inherits from Windows.Forms.Button. In the OnCreateControl method I set the style of the control so that it supports transparent backcolor and set the...
8
by: Brian Ward | last post by:
I am looking for a simple way to set the image transparency in a PictureBox. I have a moving PictureBox containing a graphic image .. moving by incrementing its Left property. The background...
0
by: MasterOfTheDark | last post by:
This one's a hairy one to explain. What I've got is a class called "VistaGroupBox" that I put some nice-looking Vista-style gradients in the background and made to look like the ribbon categories...
2
by: neovantage | last post by:
Hey all, I have created transparent PNG images from text dynamically. But it edges are pixel-ate or we can say edges are distorted. Here is my LINK which shows my generated transparent PNG image....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.