Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
AnswerRe: Building DotnetNuke module Using C# 2.0 Pin
Colin Angus Mackay10-Mar-06 12:51
Colin Angus Mackay10-Mar-06 12:51 
QuestionFileInfo.Exists returns False even if the file exists Pin
chopinrlz10-Mar-06 6:23
chopinrlz10-Mar-06 6:23 
AnswerRe: FileInfo.Exists returns False even if the file exists Pin
Dan Neely10-Mar-06 6:53
Dan Neely10-Mar-06 6:53 
AnswerRe: FileInfo.Exists returns False even if the file exists Pin
Stefan Troschuetz10-Mar-06 6:55
Stefan Troschuetz10-Mar-06 6:55 
AnswerRe: FileInfo.Exists returns False even if the file exists Pin
Guffa10-Mar-06 7:10
Guffa10-Mar-06 7:10 
AnswerRe: FileInfo.Exists returns False even if the file exists Pin
FocusedWolf10-Mar-06 8:42
FocusedWolf10-Mar-06 8:42 
QuestionImage with transparent background Pin
stu8310-Mar-06 5:33
stu8310-Mar-06 5:33 
QuestionImage with transparent background Pin
stu8310-Mar-06 5:24
stu8310-Mar-06 5:24 
Hi,
I am a c# newbie and I am having some problems.
I am trying to draw an image with a transparent background. I wan't to be able to draw it directly onto a form or on to a picturebox (or on top of anything in fact). However, with the code below, when the image is drawn on a form, the area that I want to be transparent is transparent, but it also makes that area of the form transparent so I can see applications behind the form through it Confused | :confused: Also when I try to draw the image on a picturebox, the pictuebox just covers it up completely.
The code I have written is as follows:

protected override void OnPaint(System.Windows.Forms.PaintEventArgs e )
{
Rectangle imgRect = new Rectangle(0,0, this.Width, this.Height);
Bitmap wibblyBit = new Bitmap(_upImage);
Graphics g = Graphics.FromImage(wibblyBit);
ImageAttributes ia = new ImageAttributes();
Color transparentColor = wibblyBit.GetPixel(0,0);
ia.SetColorKey(transparentColor, transparentColor);
g.DrawImage(wibblyBit, imgRect, 0, 0, upImage.Width, upImage.Height,
GraphicsUnit.Pixel, ia);

//Draw from the memory bitmap
e.Graphics.DrawImage(m_bmpOffscreen, 0, 0);

base.OnPaint(e);
}

Any help would be greatly appreciated.
Thanks in advance Smile | :)
QuestionControl visible changed event Pin
malharone10-Mar-06 4:28
malharone10-Mar-06 4:28 
AnswerRe: Control visible changed event Pin
Office Lineman10-Mar-06 6:10
Office Lineman10-Mar-06 6:10 
GeneralRe: Control visible changed event Pin
malharone10-Mar-06 7:36
malharone10-Mar-06 7:36 
GeneralRe: Control visible changed event Pin
Office Lineman10-Mar-06 7:56
Office Lineman10-Mar-06 7:56 
GeneralRe: Control visible changed event Pin
malharone10-Mar-06 8:07
malharone10-Mar-06 8:07 
GeneralRe: Control visible changed event Pin
Office Lineman10-Mar-06 8:43
Office Lineman10-Mar-06 8:43 
GeneralRe: Control visible changed event Pin
godvicien13-Oct-10 20:53
godvicien13-Oct-10 20:53 
QuestionGrid Veiw Pin
papa198010-Mar-06 4:19
papa198010-Mar-06 4:19 
AnswerRe: Grid Veiw Pin
ToddHileHoffer10-Mar-06 8:12
ToddHileHoffer10-Mar-06 8:12 
GeneralRe: Grid Veiw Pin
papa198011-Mar-06 22:39
papa198011-Mar-06 22:39 
QuestionDynamic Menu Pin
vatzcar10-Mar-06 3:56
vatzcar10-Mar-06 3:56 
AnswerRe: Dynamic Menu Pin
eggsovereasy10-Mar-06 7:40
eggsovereasy10-Mar-06 7:40 
GeneralRe: Dynamic Menu Pin
vatzcar10-Mar-06 22:17
vatzcar10-Mar-06 22:17 
AnswerRe: Dynamic Menu Pin
Luis Alonso Ramos12-Mar-06 17:52
Luis Alonso Ramos12-Mar-06 17:52 
Questionserializing a class containing hash table as one of its objects Pin
Anupam Mazumdar10-Mar-06 3:33
Anupam Mazumdar10-Mar-06 3:33 
AnswerRe: serializing a class containing hash table as one of its objects Pin
Judah Gabriel Himango10-Mar-06 3:53
sponsorJudah Gabriel Himango10-Mar-06 3:53 
Questiondrag and drop problem Pin
Gyozo Gaspar10-Mar-06 3:20
Gyozo Gaspar10-Mar-06 3:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.