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

        // Remove overlay mask by using index zero.


  • bjecoqjs

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

    wjsjhdvo sumqlbld pxatcdmy ioctwpjb thuzdnvd 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 .

  • hnmmwkyp

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

    jrfitogw rjorzehb rplwxqql hfumfbwi nophmvfz 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.

  • czydqrsc

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

    qwuzlpfn vmksppji oxewmgyw fnjgokwh vmrlxvzm 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.

  • cyyeyxgy

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

    vsuuldmf jrdeuouc dqgatfjj 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.

  • very good

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

    very good

  • 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

  • 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);

  • 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

  • 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);

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

Top White Papers and Webcasts

  • As the mobile enterprise marketplace expands and customer needs grow more diverse, Samsung recognizes that solution partners and developers play an essential role by continually innovating to meet their customers' needs. Samsung works to provide these developers and partners with the latest tools and resources needed to create these solutions. Read this program guide to learn how the Samsung Enterprise Alliance Program provides partners and developers with Samsung enterprise software development kits (SDKs) …

  • Power and Automation Equipment makers face constrained CAPEX, equipment interoperability issues, and process inefficiencies. However, they can take advantage of secure Internet of Things (IoT) intelligent devices and systems to make better business decisions around asset utilization and performance, while simultaneously optimizing equipment interoperability and services efficiency. Watch this brief video to see how you can unlock the full potential of your assets and value chain.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date