Home > Software engineering >  Win32 development, syslistview32 list box cannot be selected
Win32 development, syslistview32 list box cannot be selected

Time:09-23




Can insert a normal and columns, but the mouse can't select a ah, the selected only a small piece of area,

And there is no grid, could you tell me how to get a great god into that can choose normal, and have the kind of list box line segmentation, grateful,

Post code:

CodePudding user response:


 
HMainWnd=CreateWindow (szClassName,//the window structure name
SzAppTitle,//the window title
WS_OVERLAPPEDWINDOW & amp; ~ WS_THICKFRAME & amp; ~ WS_MAXIMIZEBOX,//the window style to be overlapping Windows, prohibit to maximize, not drag the frame to change the window size
CW_USEDEFAULT CW_USEDEFAULT,//x, y coordinates
440570,//window width and height
NULL, NULL, hInstance, NULL);
HGroupBox=CreateWindow (" BUTTON ", "code list", WS_CHILD | WS_VISIBLE | BS_GROUPBOX, 20, 80, 395, 388, hMainWnd, (HMENU) 2, NULL, NULL);
Syslistview32 hButton=CreateWindow (" ", "1111", the WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_EX_GRIDLINES | LVS_REPORT | LVS_SHOWSELALWAYS, 10, 30, 375, 350, hGroupBox, (HMENU) 700, hInstance, NULL);
LV_ITEM item;//a
LV_COLUMN colmn.//column
ZeroMemory (& amp; Item, sizeof (LV_ITEM));
ZeroMemory (& amp; Colmn, sizeof (LV_COLUMN));
Colmn. Mask=LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;//style
Colmn. PszText="ID";
Cx=0 x70 colmn.
SendMessage (hButton LVM_INSERTCOLUMN, 0, (LPARAM) & amp; Colmn);
Colmn. PszText="item name";//words
Cx=0 x8e colmn./behind/column
SendMessage (hButton LVM_INSERTCOLUMN, 1, (LPARAM) & amp; Colmn);
Colmn. PszText="remarks";//words
Cx=0 x62 colmn./behind/column
SendMessage (hButton, LVM_INSERTCOLUMN, 2, (LPARAM) & amp; Colmn);

for (int i=0; i<50; I++)
{
ListView_InsertItem (hButton, & amp; Item);//insert the first grid
ListView_SetItemText (hButton, 0, 1, "2");//insert the specified grid
}


CodePudding user response:

Set extension style ListView_SetExtendedListViewStyleEx (hListWnd LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);

CodePudding user response:

refer to the second floor zgl7903 response:
set extension style ListView_SetExtendedListViewStyleEx (hListWnd LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
ok, this problem has been solved, thank you

CodePudding user response:

CListCtrl: : SetExtendedStyle (.. LVS_EX_GRIDLINES... );
  • Related