Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
| Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 23rd, 2006, 07:30 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display icon on a webpage

Hi

I need to display an .ico file on a webpage. i have the image/icon saved as bytes in the database. From there i read it and have to render on a webpage. The problem is that to display i need to convert it to bmp format and set teh mime type to image/bmp. this causes the icon to loose its transparency and instead black color appears. Any ideas how to sole this

thanks

 
Old February 23rd, 2006, 07:36 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Location: , , Canada.
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your problem is a documented bug (822488), here's a work around.

System.Drawing.Icon Icon1;
Icon1 = new System.Drawing.Icon("c:\\Example.ico");
e.Graphics.DrawIcon(Icon1,0,0);

See the following link for more details: http://www.kbalertz.com/Feedback_822488.aspx

- A.Kahtava
 
Old February 24th, 2006, 06:37 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply.
But my prblem is displaying on a webpage.

 
Old February 24th, 2006, 08:12 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Location: , , Canada.
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Take a look at the IconExtractor class on the following link:

http://www.codeproject.com/aspnet/As...IconsImage.asp

The Author of the above tutorial seems to have solved the problem.

The Author writes:
IE has a flaw in transparent PNG rendering, causing the transparent areas to render gray. The code includes comments that help you change the implementation from PNG to GIF, losing the transparent background.

The implementation of transparent background in GIF images is way too complicated in .NET, involving unsafe blocks of code, so I decided not to include it in this sample, for the sake of simplicity.

- A.Kahtava




Similar Threads
Thread Thread Starter Forum Replies Last Post
Display icon and form caption vickyj Beginning VB 6 1 January 31st, 2006 05:55 AM
How to display a access webpage on current date kenbeyond Access VBA 2 October 13th, 2005 06:42 AM
read field description and display on webpage wpiass Access ASP 7 October 5th, 2005 06:41 AM
to display an icon in datagrid deeraj ADO.NET 4 March 30th, 2005 02:00 AM
display a pdf in a webpage crmpicco Classic ASP Basics 3 February 8th, 2005 09:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.