We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Images on a TabPageExt

Hi - I wanted to have a .png image (which has transparency) appear on a tab, but the default behavior (using an imagelist and imageIndex) doesn't seem to respect the transparency within the image (it shows up as white). Is there a better/different way to draw the image on the tab so as to get the transparency effect? Thanks!

10 Replies

IP Ivan Pelly March 13, 2003 02:27 AM UTC

Any thoughts on this one? Thanks!

RP Ramesh Praveen Syncfusion Team March 13, 2003 12:28 PM UTC

Ivan, Sorry for the delay, I will get back to you before the end of the day regarding this issue. And I suppose you are working in XP? -Praveen

IP Ivan Pelly March 13, 2003 12:35 PM UTC

No, 2000, but hopefully the solution would work for both...

RP Ramesh Praveen Syncfusion Team March 13, 2003 05:44 PM UTC

Ivan, I am not sure if this will work in win2k. Try associating the ImageList to a ListView's item and see if it draws transparently. We have also noticed that filling the ImageList through the designer with an icon that has transparency info, causes the resultant image to lose it's transparency info. So, if the above doesn't work, try filling it through code, like this for example: // Create our own 24X imagelist this.icons24X = new System.Windows.Forms.ImageList(); this.icons24X.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; this.icons24X.ImageSize = new System.Drawing.Size(24, 24); // Create a holder for reading icons System.Drawing.Icon icoHolder; // Read icon files and insert into our 24X imagelist (without losing the alpha channel) icoHolder = new System.Drawing.Icon("transIco.ico"); this.icons24X.Images.Add(icoHolder); We have tested that initing an ImageList like this is required for it to retain the alpha channel and draw semi-transparently in XP. Coming to the TabControlExt, we noticed that it was not equipped to work with these icons with alpha channel. We have internally fixed this behavior and the icons will draw with the alpha channel in (only)XP. Please login a support incident so that we can inform you when a patch is available. Regards, Praveen Ramesh

IP Ivan Pelly March 17, 2003 12:52 PM UTC

Is there perhaps a workaround, something like an OnDraw override, and using Graphics.DrawIcon to draw an icon on the tab? Thanks again. Ivan

RP Ramesh Praveen Syncfusion Team March 18, 2003 03:48 PM UTC

Ivan, That might be an option if you can't wait for our next patch. Regards, Praveen Ramesh

IP Ivan Pelly March 21, 2003 06:40 PM UTC

Any insights on how to go about this. I played around a bit, without success. Thanks.

RP Ramesh Praveen Syncfusion Team March 24, 2003 07:42 PM UTC

Ivan, This version: http://www.syncfusion.net/squiffler/Patches/v1522/patch_index.htm includes a fix for the transparency problem in the tabcontrol. Regards, Praveen Ramesh

IP Ivan Pelly March 25, 2003 06:25 PM UTC

Thanks - I installed the patch, but to no avail. I tried setting the TransparentColor of the imagelist to Transparent, then White, with the same results each time. Attached are the .png images I'm using, and a picture of the tab. (I use the same images in the grid, and they draw fine). Please let me know if I can provide any more info. Thanks!

RP Ramesh Praveen Syncfusion Team March 27, 2003 05:46 PM UTC

Ivan, Are you trying this in 2000? As I mentioned before, I don't think it will work in 2000. It has to be XP. In any case, once you load these images to an ImageList, make a ListView use this same ImageList and see how it gets drawn, it's the same way our tabs will get drawn too. Regards, Praveen Ramesh

Live Chat Icon For mobile
Up arrow icon