|
-
March 31st, 2010, 07:05 AM
#16
Re: Resize Row Height of CListCtrl
 Originally Posted by seguprasad
it is creating multiline using Cwnd. But I have to use CFormView and over CFormView, I have to use CListCtrl.
1. What is the problem to use *this* custom control on the FormView? 
2. Why do you "have to use" CListCtrl? 
 Originally Posted by seguprasad
Is ther any way to create multiline row in CListCtrl?
I don't know!
Try to search in the ListControl sections of www.codeproject.com and www.codeguru.com
Victor Nijegorodov
-
March 31st, 2010, 08:31 AM
#17
Re: Resize Row Height of CListCtrl
A CListCtrl does not provide a means to do what you ask (rows of variable height)
A CListBox can do variable row heights, but it doesn't have a lot of support for columns, you can display columns, but they're typically not user-adjustable (no header control).
A custom control like the one Victor linked is another possible alternative. The one he linked is one example, I'm sure there are other people that have made something similar as well, look around. Alternatively, you can write your own variety of a custom control that does exactly what you want.
With a load of "tweaks" you can probably make a CListCtrl sort of do what you want, with a number of restrictions.
1) Insert each row as an individual item and somehow maintain a "grouping" to know which individual rows make up a single logical item.
2) Set the listcontrol to multi selection.
3) When a row is selected, you also programmatically select all the other rows in the same grouping. When a row is deselected, you also programmatically deselect all the other rows in the same grouping.
This approach will have a number of visual, aestetical and usability issues, but this may be acceptable to you.
It's possible that for various reasons it won't work out. You're asking for doing something the CListCtrl wasn't designed for. Sometimes, you can work around that with varying degrees of success, and sometimes you can't.
-
December 22nd, 2010, 02:30 AM
#18
Re: Resize Row Height of CListCtrl
Hi all,
i m increase the row height of ListCtrl with using of this code.
Code:
1.Change the style of list control to “owner draw fixed” style!
2. m_RowList.ModifyStyle( LVS_OWNERDRAWFIXED, 0, 0 ); //in OnInitDialog
3.
void CDialogGuineaPig::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
// If this is our list control then increase height
if( nIDCtl == IDC_ROWLIST )
{
// Increase height by 10
lpMeasureItemStruct->itemHeight += 10;//10 is new row height
}
}
#1 September 24th, 2010, 12:43 AM
vjshankwar
Member + Join Date: Jan 2008
Location: India
Posts: 676
Row height of List Ctrl not change when Checkbox option used in List.
--------------------------------------------------------------------------------
Hi all,
i m increase the row height of ListCtrl with using of this code.
Code:
1.Change the style of list control to “owner draw fixed” style!
2. m_RowList.ModifyStyle( LVS_OWNERDRAWFIXED, 0, 0 ); //in OnInitDialog
3.
void CDialogGuineaPig::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
// If this is our list control then increase height
if( nIDCtl == IDC_ROWLIST )
{
// Increase height by 10
lpMeasureItemStruct->itemHeight += 10;//10 is new row height
}
}this is working fine but when i use CheckBox style in List ctrl its not working please tell me how can i increase List Row height with Checkbox.
please tell me how can i do this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
-
December 22nd, 2010, 04:32 AM
#19
Re: Resize Row Height of CListCtrl
Did you mean that the list control with LVS_EX_CHECKBOXES extended style didn't change the item height?
Is the OnMeasureItem called in the case you "use CheckBox style in List ctrl"?
Victor Nijegorodov
-
December 22nd, 2010, 04:56 AM
#20
Re: Resize Row Height of CListCtrl
 Originally Posted by VictorN
Did you mean that the list control with LVS_EX_CHECKBOXES extended style didn't change the item height?
Is the OnMeasureItem called in the case you "use CheckBox style in List ctrl"?
I would assume the list control has another ID and therefore the increase wasn't applied.
The OnMeasureItem was called once for a list control. I did it myself a year ago and there is no way out.
However the grouping suggested works quite fine if you can go without icons, checkboxes, automatic sort. I used a special background color for each second logical group and even achieved to place an edit control exactly above some multiple cells of a column in order to allow inline editing. Nevertheless the efforts were immense and if there is a custom multiline-listcontrol available I would go this way.
-
December 22nd, 2010, 06:10 AM
#21
Re: Resize Row Height of CListCtrl
even ClistCtrl is derived from CWnd right? then why dont you use scope resolution operator :: and access base class methods...
-
December 22nd, 2010, 08:10 AM
#22
Re: Resize Row Height of CListCtrl
Unless i'm mistaken, LVS_EX_CHECKBOXES and ownerdraw can't be combined.
So just for clarity sake and for all future reference.
A CListControl (a.k.a. SysListControl32 common control) CANNOT create a list where each row determines it's own size. The 'FIXED' in the LVS_OWNERDRAWFIXED is further evidence that this is the case.
You can make a CListCtrl owner draw and make the rows any height you want, but every row will have this same height.
You can "fake" multiline by using multiple list rows and handling item selection to select a group of rows, but this will have a number of visual and usage limitation/issues which may or may not be acceptable to you.
A CListBox CAN be made with rows of variable height. This is done by using the LBS_OWNERDRAWVARIABLE style (as opposed to LBS_OWERDRAWFIXED). Do NOT use the LBS_ styles on a CListCtrl, it won't work.
A CListBox however doesn't have all the features of a listcontrol. Again, the different behaviour of a listbox may or may not be an issue to you.
You can create your own type of control (or use one someone else has made) that mimics a CListCtrl as much as possible but allows multiline variable rows. Again, this may or may not have any number of isues.
You may also be able to make something that works for you by using something else entirely like a RichEdit or a CHtmlEditCtrl. It won't work and behave like a listcontrol, but you may be able to get a result that achieves what you're after.
-
December 23rd, 2010, 12:09 AM
#23
Re: Resize Row Height of CListCtrl
 Originally Posted by VictorN
Did you mean that the list control with LVS_EX_CHECKBOXES extended style didn't change the item height?
Is the OnMeasureItem called in the case you "use CheckBox style in List ctrl"?
yes.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|