Summary of several days, cedit, clistctl .......

Source: Internet
Author: User

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 ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.