I use CListViewCtrl and I want to change the size of a check box

Posted on 2006-05-25
Last Modified: 2013-11-20
I have two questions:

1. I use CListViewCtrl with checkboxes, How can I change the size of a check box?
2. Too I have a CLsitViewCtl without checkboxes. I am handling LVN_ITEMCHANGED notification but I need a notification  when I on click in the same item.
What notification I need?

Thank You.
Question by:cmsdiginet
    LVL 49

    Accepted Solution

    For the first one,
    Use the resource editor to create two bitmaps, let's call them:


    After setting up the listbox columns, get access to the CImageList and replace each of the "small images" with your own:

         CImageList* pIL= m_ctlList.GetImageList(  LVSIL_STATE  );
         int n= pIL->GetImageCount();  // eyeball check there should be two

    Use code like this to replace them:

         CBitmap bm1, bm2;
         bm1.LoadBitmap(IDB_MyBigCheckboxChecked );
         pIL->Replace(0, &bm1, RGB(255, 255, 255)); // #1

         bm2.LoadBitmap( IDB_MyBigCheckboxChecked );
         pIL->Replace(1, &bm2, RGB(255, 255, 255)); // #2

    For the second part of your question, I think you want to be notified when the item gets selected -- Is that right?

    If so, make a handler got LVN_ITEMCHANGED and when the state goes to LVIS_SELECTED then there you go.

    You could also try a handler for LVN_ITEMACTIVATE ... that looks like it would work

    -- Dan
    LVL 49

    Expert Comment

    It is unkind to grade with a B without posting any comment.  
    If there was something about the response that you think is less than A-level material, then you should ask about that and give the Expert a chance to improve his response.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    iSeries FTP Exit Program 8 99
    Prevent this page from creating additional dialogs. 3 166
    EvenOdd challenge 10 69
    sumHeights2  challenge 7 51
    In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
    Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now