Buon giorno a tutti, sto lavorando ad un progetto su windows e c++, mi servirebbe creare una listbox con diverse colonne per ora ho fatto questo:
codice:
HWND CreateCombobox(char* tempText, int x, int y, int width, int height, int identifier, HWND hwnd)
{
HWND hStaticTemp;
hStaticTemp = CreateWindowEx( 0, "LISTBOX", tempText, WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | LBS_NOINTEGRALHEIGHT , x, y, width, height, hwnd, (HMENU)identifier, hInstance, NULL);
return hStaticTemp;
}
dopo di che in una funzione faccio:
codice:
void creaElementiEliminaUtente(HWND hwnd)
{
hwndListBox = CreateCombobox("Elimina Utente", 20, 15, 400, 200, LIST, hwnd);SetDefaultFont(LIST, hwnd);
SendMessage(hwndListBox,(UINT)LB_ADDSTRING,(WPARAM)0,(LPARAM)"Matricola Nome Cognome Corso Tipo ");
int numUtenti=Utente::getNumUtenti("db.txt");
string* utenti=Utente::getUtenti("db.txt");
string utente, tab=" ";
int cont;
for(int i=0; i<numUtenti; i++)
{
char * pch;
pch = strtok (utility.stringToChar(utenti[i]),"#");
cont=0;
while (pch != NULL && cont<=4)
{
utente+=pch;//+tab.substr(0,(tab.length()-utenti[i].length()));
pch = strtok (NULL, "#"); cont++;
}
SendMessage(hwndListBox,(UINT) LB_ADDSTRING,(WPARAM)0,(LPARAM)utility.stringToChar(utente)); utente="";
}
}
io vorrei creare delle colonne in modo tale da visualizzare il testo ben formattato invece di inserire manualmente degli spazi.
come potrei fare a creare delle colonne in una listbox?