473,406 Members | 2,336 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,406 software developers and data experts.

Transparent PNG

I am trying to make image alpha transparency work in IE6. I was hoping

<img src="Graphics/TransparentLogo.png" width="249" height="42">

would work, but it doesn't. After looking around I found the work around

<div
style="FILTER:progid:DXImageTransform.Microsoft.Al phaImageLoader(src='Graphi
cs/LineViewTransparentLogo.png');WIDTH:249px;HEIGHT:4 2px">
<img src="Graphics/TransparentLogo.png" width="249" height="42"
style="FILTER:Alpha(opacity=0)">
</div>

which works perfectly, but is very ugly. I was hoping that by using the
asp:image tag, I would output the ugly version to IE6, and the neat version
to other browsers. I tried

<asp:image width="249" height="42" imageurl="Graphics/TransparentLogo.png"
alternatetext="LineViewT" runat="server" id="Image1">
</asp:image>

but this always outputs the neat non-working (in IE6) version. Is there a
way to make it output the different version, depending on the browser is
detects?

Thanks,
ME

--
Martin Eyles
ma**********@NOSPAM.bytronic.com
Nov 18 '05 #1
6 3994
Hi,

You can create a webcontrol which derives from HtmlImage.
On PreRender you have to check HttpContext.Current.Request.Browser.... to
find what is the current browser used by the client.
After that you modify or add style property and it's good.

Franck.

I don't know if you have yet created webcontrols. So i can give you a sample
i have done.
It's a webcontrol i use to change the style of an image when the mouse
hovers on.

using System;

using System.Web;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

namespace eMill.UI.Web.Controls

{

/// <summary>

/// Summary description for HoverImage.

/// </summary>

public class HoverImage : HtmlImage

{

public HoverImage() {}

public string ToolTip {

get {

Object savedState = this.ViewState["ToolTip"];

if ( savedState != null ) {

return (string)savedState;

}

return string.Empty;

}

set {

this.ViewState["ToolTip"] = value;

}

}

public string HoverImageSrc {

get {

Object savedState = this.ViewState["HoverImageSrc"];

if ( savedState != null ) {

return (string)savedState;

}

return string.Empty;

}

set {

this.ViewState["HoverImageSrc"] = value;

}

}

protected override void RenderAttributes(HtmlTextWriter writer) {

if(HoverImageSrc.Length > 0) {

Attributes.Add("onmousemove", "this.src=\"" + HoverImageSrc + "\"");

Attributes.Add("onmouseout", "this.src=\"" + Src + "\"");

}

if(ToolTip.Length > 0) {

Attributes.Add("title", ToolTip);

}

base.RenderAttributes (writer);

}

}

}
Hope this helps!
Franck.

"Martin Eyles" <ma**********@NOSPAM.bytronic.com> wrote in message
news:10*************@corp.supernews.com...
| I am trying to make image alpha transparency work in IE6. I was hoping
|
| <img src="Graphics/TransparentLogo.png" width="249" height="42">
|
| would work, but it doesn't. After looking around I found the work around
|
| <div
|
style="FILTER:progid:DXImageTransform.Microsoft.Al phaImageLoader(src='Graphi
| cs/LineViewTransparentLogo.png');WIDTH:249px;HEIGHT:4 2px">
| <img src="Graphics/TransparentLogo.png" width="249" height="42"
| style="FILTER:Alpha(opacity=0)">
| </div>
|
| which works perfectly, but is very ugly. I was hoping that by using the
| asp:image tag, I would output the ugly version to IE6, and the neat
version
| to other browsers. I tried
|
| <asp:image width="249" height="42" imageurl="Graphics/TransparentLogo.png"
| alternatetext="LineViewT" runat="server" id="Image1">
| </asp:image>
|
| but this always outputs the neat non-working (in IE6) version. Is there a
| way to make it output the different version, depending on the browser is
| detects?
|
| Thanks,
| ME
|
| --
| Martin Eyles
| ma**********@NOSPAM.bytronic.com
|
|

Nov 18 '05 #2
why don't you just convert the image to a transparent gif, which is
supported by IE.

-- bruce (sqlwork.com)

"Martin Eyles" <ma**********@NOSPAM.bytronic.com> wrote in message
news:10*************@corp.supernews.com...
| I am trying to make image alpha transparency work in IE6. I was hoping
|
| <img src="Graphics/TransparentLogo.png" width="249" height="42">
|
| would work, but it doesn't. After looking around I found the work around
|
| <div
|
style="FILTER:progid:DXImageTransform.Microsoft.Al phaImageLoader(src='Graphi
| cs/LineViewTransparentLogo.png');WIDTH:249px;HEIGHT:4 2px">
| <img src="Graphics/TransparentLogo.png" width="249" height="42"
| style="FILTER:Alpha(opacity=0)">
| </div>
|
| which works perfectly, but is very ugly. I was hoping that by using the
| asp:image tag, I would output the ugly version to IE6, and the neat
version
| to other browsers. I tried
|
| <asp:image width="249" height="42" imageurl="Graphics/TransparentLogo.png"
| alternatetext="LineViewT" runat="server" id="Image1">
| </asp:image>
|
| but this always outputs the neat non-working (in IE6) version. Is there a
| way to make it output the different version, depending on the browser is
| detects?
|
| Thanks,
| ME
|
| --
| Martin Eyles
| ma**********@NOSPAM.bytronic.com
|
|
Nov 18 '05 #3
"bruce barker" <no***********@safeco.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
why don't you just convert the image to a transparent gif, which is
supported by IE.


I will have no alpha layer anti-aliasing in a gif, so will have jagged
edges.

--
Martin Eyles
ma**********@NOSPAM.bytronic.com
Nov 18 '05 #4
First PNG is normalized :)
Second PNG can have more than 256 Colors.
Third PNG has gradient transparency.

Franck.

"bruce barker" <no***********@safeco.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
| why don't you just convert the image to a transparent gif, which is
| supported by IE.
|
| -- bruce (sqlwork.com)
|

Nov 18 '05 #5
Martin Eyles wrote:
I am trying to make image alpha transparency work in IE6. I was hoping

<img src="Graphics/TransparentLogo.png" width="249" height="42">

would work, but it doesn't. After looking around I found the work
around

<div
style="FILTER:progid:DXImageTransform.Microsoft.Al phaImageLoader(src='Graphi
cs/LineViewTransparentLogo.png');WIDTH:249px;HEIGHT:4 2px">
<img src="Graphics/TransparentLogo.png" width="249" height="42"
style="FILTER:Alpha(opacity=0)">
</div>

which works perfectly, but is very ugly. I was hoping that by using
the asp:image tag, I would output the ugly version to IE6, and the
neat version to other browsers. I tried

<asp:image width="249" height="42"
imageurl="Graphics/TransparentLogo.png" alternatetext="LineViewT"
runat="server" id="Image1"> </asp:image>

but this always outputs the neat non-working (in IE6) version. Is
there a way to make it output the different version, depending on the
browser is detects?

Thanks,
ME


see here:
http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html
Nov 18 '05 #6
"Hans Kesting" <ne***********@spamgourmet.com> wrote
Martin Eyles wrote:
I am trying to make image alpha transparency work in IE6. I was hoping

<img src="Graphics/TransparentLogo.png" width="249" height="42">

would work, but it doesn't....


see here:
http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html


Thanks Hans, the javascript code is very useful. Don't like the 'behaviour'
idea, but I'll fix that and make it normal javascript.

ME

--
Martin Eyles
ma**********@NOSPAM.bytronic.com
Nov 18 '05 #7

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

Similar topics

4
by: R.Marquez | last post by:
I am trying to create a simple script that Opens an existing PNG and resaves it with a transparent color. With the command line version of ImageMagic this is an easy endevor (and my current...
1
by: Efkas | last post by:
My application have some level : 1. MyButton class with Label inheritance 2. MyComponent as User Control loading and positionning some of MyButtons 3. MyApp loading and positionning MyComponent ...
3
by: Steve Koon | last post by:
Any thoughts on getting this project to work or suggesting another method would be appreciated. Steve ========================================== Project: A Windows Form which acts as a...
7
by: Peter Oliphant | last post by:
Using MakeTransparent one can supposedly turn a color used in a Bitmap to transparent. But, it looks to me like all it does it set these pixels to the color BackColor of the Control it's attached...
5
by: Mark Deibert | last post by:
I'm a former VB6 coder. Quit a few years ago. Now I'm back and trying to teach myself VB.NET. I don't remember having this much difficulty learning VB6. I'm totally stuck on something and need your...
8
by: Grahammer | last post by:
Is it possible to set the background of a usercontrol as transparent? I tried setting the background image of the usercontrol to a transparent GIF, but that caused MAJOR problems. I'm making...
4
by: jcrouse | last post by:
I am using the following code to move a label on a form at runtime: If myMousedown = lblP1JoyRight.Name Then If lblP1JoyRight.BackColor.Equals(Color.Transparent) Then bTransCk = True ...
2
by: Pascal | last post by:
Je veux que mes label soit transparent aussi sur mes picturebox alors j'écris : i want my labels to be transparent on my pictureboxes so i wrote : Private Sub Form1_Load(ByVal sender As Object,...
4
by: ray well | last post by:
in my app i need to make a RichTextbox control transparent. i need it to be a like a pane of glass lying on a sheet of paper, where u can see everything on the sheet of paper not covered by text...
4
by: Dale | last post by:
I am creating GIF images with transparent backgrounds on-the-fly for a web app and rendering them by using System.Drawing.Image.Save(Response.OutputStream, ImageType.GIF). I am confident that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.