Using overlay images


The tree view in conjunction with the image list allows upto four overlay images. Overlay images are images that are drawn transparently over another image. The overlay images are supported only for the item images and not for the state images. Unlike what the documentation says, you can choose any image in the image list to serve as an overlay image it need not be among the first 15.
 

Step 1: Set up the overlay images

The image list has to be set up with the overlay images by calling the function SetOverlayImage(). Upto four images can be added to the list of overlay images. Call this function for the image list object associated with the tree view control for the item images. We can call this function before we associate the image list with the tree view control or after it does not matter. Normally this code would be clubbed with the code where you create the image list and associate it with the tree view control.

The SetOverlayImage() takes two arguments. The first argument is the index of the image within the image list that you want to use as an overlay mask. If you want the third image in the list to be an overlay mask then this value would be 2 and if you want the tenth image, this value would be 9.

The second argument is the one-based index of the overlay mask. This argument can have a value of 1 to 4 inclusive. This serves as the identifier for the overlay mask. If you are using only one image as an overlay mask, you can choose any of the four index it need not be one necessarily. Also, if you call SetOverlayImage() for two different images with the same overlay mask index then the latter call will supercede the previous call.

 
        m_tree.m_image.SetOverlayImage(15, 1 );
        m_tree.m_image.SetOverlayImage(16, 2 );
        m_tree.m_image.SetOverlayImage(18, 3 );
        m_tree.m_image.SetOverlayImage(20, 4 );
 

Step 2: Set the item state to use the overlay mask

You can specify the overlay mask when inserting a new item or you can specify it later by calling SetItemState(). We actually use to the macro INDEXTOOVERLAYMASK() to specify the overlay mask index.
 
        // Use third overlay mask
        SetItemState( hItem, INDEXTOOVERLAYMASK(3), TVIS_OVERLAYMASK );

        // Remove overlay mask by using index zero.
        SetItemState( hti, INDEXTOOVERLAYMASK(0), TVIS_OVERLAYMASK );



Comments

  • bjecoqjs

    Posted by lqbwiymv on 04/21/2013 04:43pm

    wjsjhdvo http://louisvuittonoutletjetztoffz.de/ sumqlbld http://abercrombieandfitchoutlettz.co.uk/ pxatcdmy http://louisvuittonhandtaschenoffz.de/ ioctwpjb http://getithollisteruk.co.uk/ thuzdnvd http://thomassabocharmsbuyitaus.com/ wprtwsgw louis vuitton outlet dnmkdyhi abercrombie and fitch outlet czjjxxya louis vuitton taschen outlet burugtua hollister uk wztqbyye thomas sabo charms 10) {the most|the foremost|just about the most|quite possibly the most|the best} {abundantly|generously} mutated {in|through|during|on|around} 24% {and|not to mention|together with|and even|plus} 39% {of|from|for|in|with} {cases|occurrences|incidents|occasions|scenarios}, respectively. {Get|Find|Acquire|Pick up|Have} {him|your ex|your pet|your man|the pup} {something|a thing|one thing|a specific thing|a little something} {to show|to demonstrate|showing|to point out|of showing} {off|off of|away from|apart|out of}. {He|Your dog|They|This individual|The guy} {covered|taken care of|coated|included|lined} {the|a|your|the particular|typically the} Hershey {Bears|Provides|Holds|Contains|Teddy bears} {of the|of your|in the|with the|of this} {American|Usa|National|U .

    Reply
  • hnmmwkyp

    Posted by gqdalkfs on 04/21/2013 01:57pm

    jrfitogw http://oakleysunglassesaustraliao.co.uk/ rjorzehb http://casquebeatspascherq.fr/ rplwxqql http://louisvuittonwalletet.com/ hfumfbwi http://hollisteroutletlet.co.uk/ nophmvfz http://todsbagndrivingshoese.com/ nswzjgfe oakley sunglasses australia tqiiiypm casque beats pas cher ttafjkya louis vuitton wallet tyoyhgfk hollister outlet dnuykkke tods shoes sale Make sure you undergo he or she Alaska halibut salmon offshore fishing; you might feeling your resource in the world. twenty eight of your those people ingested a dosage in absolute African mango extract the moment per day, together with the many others taken in an important placebo. These kind of tanks are mounted on a deplete by having a hose pipe.

    Reply
  • czydqrsc

    Posted by jqajkisg on 03/13/2013 05:00pm

    qwuzlpfn http://louisvuittonuk1.co.uk/ vmksppji http://louisvuittonhandbags1.co.uk/ oxewmgyw http://louisvuittonoutletzuk.co.uk/ fnjgokwh http://cheaplouisvuittons-bags.com/ vmrlxvzm http://louisvuitton-speedyz.com/ kgdgtjhx louis vuitton uk gmkinyki louis vuitton bags upnleuyk louis vuitton outlet uk ltywofvj cheap louis vuitton bags vkwkbtxd louis vuitton bag Help leadership main dairy products yili's radar knife Them is based on the news haly (holy) in addition to booty (ripped fish). Sorry to say, accidents manifest often, perhaps even on the finest involving drivers.

    Reply
  • cyyeyxgy

    Posted by ovckuwic on 03/07/2013 12:05am

    vsuuldmf http://louissvuittonhandbagss.com/ jrdeuouc http://louissvuittonoutlet.com/ dqgatfjj http://beatsbydrebeatsz.com/ eqjuquyj louis vuitton handbags hjapeqvu louis vuitton outlet riwujnlf beats by dre It does not let the shape undertake anything out of place. This deviates by other mango fruits as this yields an important strange seed products, which residents associated with Photography equipment refer to while 'Dikka nuts'. You are teamed all the way up using knowledgeable guide.

    Reply
  • very good

    Posted by lingsnow on 06/19/2006 05:50am

    very good

    Reply
  • How to Simultaneously associate two imagelists with a tree control

    Posted by Legacy on 04/12/2001 12:00am

    Originally posted by: Dan Foster

    Your example shows two image lists, but doesn't explain how to accomplish this.

    Please give instructions on how to show two images next to the tree control.

    If you send me your email, I can draw an example of this in microsoft paint for what I need.

    Thank you,
    Dan Foster

    Reply
  • More again on "Using Overlay Images"

    Posted by Legacy on 10/19/2000 12:00am

    Originally posted by: Shayne Kennedy

    Also, if using CListCtrl make sure you allow the setting of the state member of your LV_ITEM structure with LVIF_STATE.
    
    

    Here's a code fragment that worked for me.

    // add overlay image to control's image list
    CImageList* imageList = GetImageList();
    imageList->SetOverlayImage(1, 1);

    // setup the primary image
    LV_ITEM m_lvi.mask;
    m_lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_STATE;
    m_lvi.iItem = listItemRow;
    m_lvi.iSubItem = 0;
    m_lvi.iImage = 0; // the primary image

    // add the overlay
    m_lvi.stateMask = LVIS_OVERLAYMASK;
    m_lvi.state = INDEXTOOVERLAYMASK(1);
    SetItemState( position, &m_lvi);

    Reply
  • more on "Using overlay images"

    Posted by Legacy on 07/18/1999 12:00am

    Originally posted by: Jeff Lehmer


    or if you create your bitmap with this "Create()" you can specify what color in your bitmap will be made transparent:


    // using white for the overlay mask color to ignore
    m_ctlImage.Create(IDB_TREEVIEW,16,0,RGB(255,255,255));


    Reply
  • Using overlay images

    Posted by Legacy on 10/27/1998 12:00am

    Originally posted by: Jeff Lundgren

    Make sure you use the ILC_MASK flag when creating the imagelist
    
    

    Like this:
    m_ImageList.Create(16, 16, ILC_COLOR4 | ILC_MASK, 0, 1);


    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • Live Event Date: September 10, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild". This loop of continuous delivery and continuous feedback is …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds