How to increase a cells height and width in ListControl - mfc

How can we increase the the height and width of a cell in List
It is created using Listcontrol MFC

Write a custom list control (owner
drawn).
handle message MEASUREITEM_REFLECT
set the cell height and width in the
method:
MeasureItem( LPMEASUREITEMSTRUCT
lpMeasureItemStruct )

To set the cell width take a look at the ListView_SetColumnWidth Win32 function.
One way to set the height is to attach an image list to the list control. The list control will then set the row height based on the height of the icons in the image list.

An easy way to set the cell height of a list control is by supplying an image list of the required height:
In the header:
CImageList m_imageList;
In the implementation:
m_imageList.Create(68, 68, ILC_COLOR4, 10, 10); // 68 = cell height in pixels
m_list.SetImageList(&m_imageList, LVSIL_SMALL);
Setting the cell width is achieved by simply calling SetColumnWidth (as pointed out by jussij)

Related

Draw.io autosize by keeping width fixed, and expanding height if needed

Is there a way in draw.io, to autosize a text container, keeping it's width fixed, and telling draw.io to only adjust the height if neccessary?
I tried out almost all options in the properties of the text box, but when I apply the autosize, it always overwrites my set width and height, by making the width larger, and the height smaller.
I am putting these texts inside a swimlane, and what I would like to achieve is, either:
when I add text to these text rectangles, the rectangle and the swimlane should expand automatically, but only vertically, ie, only the height of it should change (this would be the best for me, so that it is automatic)
if the automatic solution is not achievable, I would be happy with something like manually pressing the autosize button, and draw.io should keep my width fixed, and change the size of the height only.
Couldn't find any documentation anywhere. But I notice that the behaviour of auto wrap is different depending on the object type that you choose. For example,
The above one is a "Rectangle". it won't resize the width when auto-sizing. The bottom one is a "UML/Object". It will resize both the width and height.

AdjustWindowRect() off by 7 pixels?

int width=640, height=480;
RECT rect{0,0,width,height};
const DWORD style = WS_VISIBLE|WS_OVERLAPPEDWINDOW;
AdjustWindowRect(&rect,style,false);
auto hwnd = CreateWindowA("listbox","test",style,CW_USEDEFAULT,CW_USEDEFAULT,rect.right-rect.left,rect.bottom-rect.top,nullptr,nullptr,nullptr,nullptr);
The client rectangle is 640x473. What did I do wrong?
when you use List Box control the result height is depend from LBS_NOINTEGRALHEIGHT style:
Specifies that the size of the list box is exactly the size specified
by the application when it created the list box. Normally, the system
sizes a list box so that the list box does not display partial items.
so without this style, default List Box window procedure resize window, for not display partial items

CComboBox::SetItemHeight() increases both the Item and control height

I am using a class that is the descendant of CComboBox. The problem occurs when I call the CComboBox::SetItemHeight method to set the height of my combobox items using the following code:
m_searchComboBox.SetItemHeight(0,17);
It sets the height of Items but the height of the control (dropdown list) is also increased and the new height is larger than the height I set through Dialog Box. I also tried the following code:
m_searchComboBox.SetItemHeight(-1,17);
But that sets the height of the edit-control not the height of items. What should I do to set the height of Combobox items without disturbing the height of dropdown list?

Set max width of a Gtk::TextView

I've created a textview which is being filled by a Gtk::TextBuffer, however the buffer contains a lot of characters and the window gets wider than the width of the screen.
Is there a way to define a max width for a Gtk::TextView?
Put the text view in a Gtk::ScrolledWindow and set the size request of the scrolled window.

XTK change the height and width of a canvas

I would know if it possible to change the height and the width of a canvas genarated after the init of a X.render2D of a volume object(.nii.gz)
You can modify the height and width of the container div and then fire a window resize event. XTK catches the event and adjusts the canvas according to the container height and width after that.