List Control with LVS_LIST style

Posted on 2006-06-08
Last Modified: 2013-11-20
I have added a list control from resource onto a dialog box.

CListCtrl m_lcFileView;

Now i want to make the list control style to change to list view like the Tile View in a Notepad Save As Dialog Box when we click the view menu.

I have written the following code to change its style to List view like the Tile view.
I have images of the size 50 pixels width and height both.
When we click any item in this view then text and image both gets selected  but the selection which happens is of the height of the image which is not the actual way it happens in general for any other list control style.


Please help me restore the selection to the height of the text only .
Question by:ashugarg00
    LVL 22

    Expert Comment


    Author Comment

    can u give me an example of how to fill the LVTILEVIEWINFO  structure to ajust an image of 50 pixels height and width both with text as New Folder.
    Fill the structure such that the selection fits to the height of text New Folder.
    LVL 22

    Accepted Solution

    this is sample code :

    st1.cbSize =sizeof(st1);
    st1.dwMask = LVTVIM_COLUMNS;
    st1.dwFlags = LVTVIF_AUTOSIZE;
    st1.cLines = 2;     //allowed 2 additional lines for each item in the listctrl's tile view
    st1.sizeTile = sz; //title size
    st1.rcLabelMargin = rc; //margin

    for more have a look at members of LVTILEVIEWINFO.


    Author Comment

    I tried the code but the selection is still of the same height .
    Do i have to use an owner drawn list control for this?

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
    Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
    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.
    This video discusses moving either the default database or any database to a new volume.

    755 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

    20 Experts available now in Live!

    Get 1:1 Help Now