Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HWND ListViewCreate(HWND hparent)
- {
- INITCOMMONCONTROLSEX icex;
- icex.dwSize = sizeof(icex);
- icex.dwICC = ICC_LISTVIEW_CLASSES;
- InitCommonControlsEx(&icex);
- RECT clientrect;
- GetClientRect(hparent, &clientrect);
- HWND hwndListView = CreateWindow(WC_LISTVIEW, _T("IDC_LVSTUDENT"), WS_CHILD|WS_VISIBLE|LVS_REPORT | LVS_AUTOARRANGE | WS_BORDER, 10, 10, clientrect.right - clientrect.left -410,
- clientrect.bottom - clientrect.top - 20, hparent, (HMENU)IDC_LISTVIEW, hInst, NULL);
- return hwndListView;
- }
- bool CreateColumn(HWND hLV)
- {
- LVCOLUMN lvc;
- int iCol;
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
- lvc.cx = 150;
- for(iCol = 0; iCol < 4; iCol++)
- {
- lvc.iSubItem = iCol;
- switch(iCol)
- {
- case 0:
- lvc.pszText = _T("NoE");
- break;
- case 1:
- lvc.pszText = _T("Nom et Prenom");
- break;
- case 2:
- lvc.pszText = _T("Date de naissance");
- break;
- case 3:
- lvc.pszText = _T("Courrier");
- }
- if(iCol > 0)
- lvc.fmt = LVCFMT_CENTER;
- else
- lvc.fmt = LVCFMT_LEFT;
- if(ListView_InsertColumn(hLV, iCol, &lvc) == -1)
- return false;
- }
- return true;
- }
- bool CreateItem(HWND hLV, int iCol, TCHAR Item[])
- {
- LVITEM lvI;
- lvI.pszText = Item;
- lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
- lvI.stateMask = 0;
- lvI.iSubItem = iCol;
- lvI.state = 0;
- lvI.iItem = iItem;
- if (iCol == 0)
- {
- if (ListView_InsertItem(hLV, &lvI) == -1)
- {
- return false;
- }
- return true;
- }
- else
- {
- if (ListView_SetItem(hLV, &lvI) == -1)
- {
- return false;
- }
- return true;
- }
- }
- HWND PushButtonCreate(HWND hParent, int ID, int Position, TCHAR Name[])
- {
- int X, Y, WIDTH, HEIGHT;
- X = Position;
- Y = 10;
- WIDTH = 100;
- HEIGHT = 40;
- HWND hbtn = CreateWindow(_T("BUTTON"), Name, WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, X, Y, WIDTH, HEIGHT, hParent, (HMENU)ID, hInst, NULL);
- return hbtn;
- }
- HWND TextBoxCreate(HWND hParent, int ID, int Position, TCHAR Name[], int Type)
- {
- int X, Y, WIDTH, HEIGHT;
- X = 650;
- Y = Position;
- WIDTH = 100;
- HEIGHT = 40;
- HWND hbtn;
- if(Type == 1)
- hbtn = CreateWindow(_T("EDIT"), Name, WS_CHILD | WS_VISIBLE| ES_LEFT | ES_MULTILINE | WS_BORDER | WS_DISABLED, X, Y, WIDTH, HEIGHT, hParent, (HMENU)ID, hInst, NULL);
- if(Type == 0)
- {
- X = 750;
- WIDTH = 240;
- hbtn = CreateWindow(_T("EDIT"), Name, WS_CHILD | WS_VISIBLE| ES_LEFT | ES_MULTILINE | WS_BORDER, X, Y, WIDTH, HEIGHT, hParent, (HMENU)ID, hInst, NULL);
- }
- return hbtn;
- }
- void AddFunction(HWND hLV)
- {
- LPTSTR Noe, Nom, Dat, Mail;
- Noe = new TCHAR[50];
- Nom = new TCHAR[50];
- Dat = new TCHAR[50];
- Mail = new TCHAR[50];
- Edit_GetText(hNoe, Noe, 50);
- Edit_GetText(hName, Nom, 50);
- Edit_GetText(hDate, Dat, 50);
- Edit_GetText(hMail, Mail, 50);
- if(Noe == _T("") || Nom == _T("") || Dat == _T("") || Mail == _T(""))
- MessageBox(hLV, _T("Bạn cần nhập toàn bộ thông tin"), ERROR, MB_OK);
- else
- {
- CreateItem(hLV, 0, Noe);
- CreateItem(hLV, 1, Nom);
- CreateItem(hLV, 2, Dat);
- CreateItem(hLV, 3, Mail);
- iItem++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement