I need to create a ListControl in MFC, each row having different number of columns.
How can I do this?
That's not possible. The workaround is trivial, just don't put any text in the sub-item.
You may refer to my guru's(Chris Maunder-Codeproject founder) article:
http://www.codeproject.com/KB/miscctrl/gridctrl.aspx
You could use custom-draw List Control. Then you can specify maximum columns for the control, but draw only specified number of columns in each row. You can fill unwanted columns with a background color. Here's a sample of how you could create custom-draw list control.
Related
I am using wxtreelistctrl to construct a tree and I want to store 4 columns in it, but while displaying I want to display only 2 columns. Is there any way I can do this?
With wxTreeListCtrl this is not directly supported, but you could set column width to 0 as a quick and dirty hack.
With wxDataViewCtrl itself, you can perfectly well show just some of the columns of your wxDataViewModel in the GUI control.
I have a CollectionView with custom cells and I want to have different spacing between each of these cells. Using minimumlinespacing, it affects all the cells. Is there anyway to specifically change the spacing between 2 specific cells? Thanks!
There are more than one way to solve this.
You can use sizeForCell method to resize your specific cell according to indexPath
You can create two cells: one for more spacing, second with compact spacing and call dequqeResuseableCell accordingly.
I'm using a CListCtrl with my own "DrawItem" to draw some custom graphics into the first column, in front of the text. The text is moved ~20 pixels to the right for this. That part works.
If the user double-clicks the column divider in the header, Windows calculates the best column width. But of course Windows doesn't know my custom drawing. So the result is ~20 pixels too small for the first column.
How can I correct that?
Found a workaround:
I can trick MFC into thinking that the list control uses checkboxes:
pMyList->SetExtendedStyle(pMyList->GetExtendedStyle() | LVS_EX_CHECKBOXES);
The user will never ever see the system's checkboxes (because of my custom drawing), but this gives me just the space that I need.
I need to display rows in UltraGrid starting from bottom and going towards the top rather then normally where they are displayed from the top to the bottom.
Is there a setting of a property that needs to be set to achieve this display? I can't seem to find it.
Example of required layout
This functionality isn't built into the WinGrid control and you should log a new product idea on the NetAdvantage for Windows Forms product idea page for this if you are looking for this functionality.
You may be able to do something like this using a creation filter to move the existing rows if there are not enough rows to fill the grid. If you do pursue this you would still need to sort the rows so that they are already in the correct order first and they you would move the existing rows down when they don't fill the entire grid. There are more details on creation filters in the help.
In my MFC program,I want to display different size images in a list!
I use CListCtrl and CImageList!
But the CImageList only can load fixed images!
Variable row heights in CListCtrl is not supported. You could take a look at this article that describes a control based on CWnd that handles drawing of variable row heights.
I would consider to use the so called "owner drawn" mode to draw these myself. I don't know about another option (there is no built-in mode)... Maybe you can also take the biggest size and fit the smaller images into the bigger frames but I think it will be the same effort and be less efficient...
I mean use the
CListCtrl::DrawItem()
method
Create a "grid," a non-symmetrical grid most likely, on a dialog or Form. Then populate it with irregular shaped images as you choose. If you need more space look into a Scrollable “whatever,” view, dialog, etc.
Irregular or non rectangular shaped bitmaps seems a good place to start.