Gradually increase ~
1. clistctl
Insert clistctl:
DWORD dwstyle =: getwindowlong (m_list.m_hwnd, gwl_style );
Setwindowlong (m_list.m_hwnd, gwl_style, dwstyle | lvs_report );
DWORD exstyle = m_list.getextendedstyle ();
M_list.setextendedstyle (exstyle | lvs_ex_fullrowselect | lvs_ex_gridlines );
M_list.insertcolumn (0, _ T ("streamline ID"), lvcfmt_center, strlen (_ T ("streamline ID") * 20, 0 );
M_list.insertcolumn (1, _ T ("license plate number"), lvcfmt_center, strlen (_ T ("license plate number") * 20, 0 );
M_list.insertitem (0, "1 ");
M_list.setitemtext (0, 0, "123 ");
M_list.setitemtext (, "A-745158 ");
2. Click the clistctl column and content:
Void ceditdlg: onnmdblclklist1 (nmhdr * pnmhdr, lresult * presult)
{
// Todo: add control notifications hereProgramCode
Nm_listview * pnmlistview = (nm_listview *) pnmhdr;
Int ROW = pnmlistview-> iItem;
Int Col = pnmlistview-> isubitem;
Cstring m_text = m_list.getitemtext (row, col );
* Presult = 0;
}
3. Set and obtain cedit content
Suppose there is cedit m_edit;
Cstring STR;
M_edit.getwindowtext (STR );
M_edit.setwindowtext (_ T ("this is a test "));
Or:
Getdlgitem (idc_edit1)-> setwindowtext ("sdfsa ");
Getdlgitem (idc_static1)-> setwindowtext ("sdfsa ");
The following continues ....
//////////////////////////////////////// ////////////
//////////////////////////////////////// /////////////
1. Set the cedit background color
You need to add a message function:
Hbrush ceditdlg: onctlcolor (CDC * PDC, cwnd * pwnd, uint nctlcolor)
{
Hbrush HBr = cdialog: onctlcolor (PDC, pwnd, nctlcolor );
If (nctlcolor = ctlcolor_edit)
{
PDC-> settextcolor (RGB (0, 0, 255); // font color
PDC-> setbkcolor (RGB (192,192,255); // font background color ******
Hbrush B = createsolidbrush (RGB (192,192,255); // background color
Return B;
}
Return HBr;
}
In vs2005, click wm_ctlcolor in the message to add the onctlcolor function. Copy the code to the function.
2. Set lictctrl as the parent window of Edit
M_cedit.setparent (& m_clistctrl );
This can solve the problem that cedit cannot be edited on listctrl ~