[Last Call] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2006-05-25
Medium Priority
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
  • 2
LVL 49

Accepted Solution

DanRollins earned 750 total points
ID: 16765547
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

ID: 16770559
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Loops Section Overview
Suggested Courses
Course of the Month17 days, 15 hours left to enroll

829 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