Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Why VirtualTree use Icon instead of Bitmap?

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
netdecompiler



Joined: 28 Mar 2006
Posts: 1

PostPosted: Tue Mar 28, 2006 2:52 pm    Post subject: Why VirtualTree use Icon instead of Bitmap? Reply with quote

I am thinking to change standart TreeView to VirtualTree.

But TreeView uses bitmaps and ImageList. Why VirtualTree uses icons?

One can convert bitmap to icon:

Icon _myIcon = Icon.FromHandle(_bitmap.GetHicon());

and this work. But new icon is not transparent.

In the TreeView I can write:

imageList1.TransparentColor = System.Drawing.Color.White;

and get transparent image.
_________________
Kozlov Ruslan
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Mar 28, 2006 10:14 pm    Post subject: Reply with quote

The reason we use Icons is that icons handle transparency properly. Setting transparency for bitmaps is a hack to workaround the fact that bitmaps don't actually have true transparency support. The only reason that the standard TreeView uses bitmaps and ImageLists is that this is what it use the standard Windows Tree control which requires this approach.

ImageLists are ugly to use because they force you to work in two places and deal with indexes. Any good control written from the ground up and managed .NET code should avoid using ImageLists.

It is very easy to convert your bitmaps to icons using the Visual Studio resource editor. Simply create an icon the same size (and number of colors) as your bitmap then copy and paste the content of the bitmap into the icon. Then use the icon editor to set the transparent area.

It is possible to convert bitmaps to icons programmatically (converting a specific color to transparent) but the above method would be preferable in terms of performance.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group