• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1201
  • Last Modified:

List Control with LVS_LIST style

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.

m_lcFileView.ModifyStyle(0,LVS_LIST);
m_lcFileView.ModifyStyle(LVS_ALIGNTOP,LVS_ALIGNLEFT);
m_ilListView.Create(50,50,ILC_COLOR24|ILC_MASK,5,1);
bitmapList.LoadBitmap(IDB_BITMAP_ICON_VIEW);
m_ilListView.Add(&bitmapList,RGB(255,0,255));
m_lcFileView.SetImageList(&m_ilListView,LVSIL_SMALL);

Please help me restore the selection to the height of the text only .
0
ashugarg00
Asked:
ashugarg00
  • 2
  • 2
1 Solution
 
ashugarg00Author Commented:
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.
0
 
mahesh1402Commented:
this is sample code :

LVTILEVIEWINFO st1;
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
m_listctrl.SetTileViewInfo(&st1);

for more have a look at members of LVTILEVIEWINFO.

-MAHESH
0
 
ashugarg00Author Commented:
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?
0

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!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now