我用CWnd生成了一个对象,想把背景色变一下,可它只有GetStyle方法,没有SET之类的方法,我要用哪一个才可以?大家告诉我一下

解决方案 »

  1.   

    MFC provides a helper routine for registering a window class. Given a set of attributes (window class style, cursor, background brush, and icon), a synthetic name is generated, and the resulting window class is registered. For example,const char* AfxRegisterWndClass(UINT nClassStyle, HCURSOR hCursor,    HBRUSH hbrBackground, HICON hIcon);This function returns a temporary string of the generated registered window class name. See the Class Library Reference for more details.The string returned is a temporary pointer to a static string buffer which is valid until the next call to AfxRegisterWndClass. If you want to keep this string around, store it in a CString variable. For example,CString strWndClass = AfxRegisterWndClass(CS_DBLCLK, ...);
    ...
    CWnd* pWnd = new CWnd;
    pWnd->Create(strWndClass, ...);
    ...AfxRegisterWndClass