VC createwindow: create a window control and set the font
Hwnd hbtn, hedit, htext, hcombbox; hbtn = createwindow (// click to create "button", "Create button", ws_child | ws_visible | bs_pushbutton | bs_center | bs_vcenter, 100,100, 90,28, m_hwnd, null, AfxGetInstanceHandle (), 0); hedit = createwindow (// Edit Control "edit", "CREATE ", ws_visible | ws_child | ws_border/* | dt_center */| dt_vcenter, m_hwnd, null); hfont = (hfont) getstockobject (default_gui_font );:: sendmessage (hedit, wm_setfont, (wparam) hfont, 1); // set the control Font: sendmessage (hbtn, wm_setfont, (wparam) hfont, 1 ); hcombbox = createwindow ("ComboBox", "1", ws_child | ws_visible | ws_border | cbs_autohscroll | cbs_dropdownlist, 220,100,100, 25, m_hwnd, null );
1. Solutions to font size problems:
Create a font that you want.
Hfont = (hfont) getstockobject (default_gui_font );
Then send a message to edit.
Sendmessage (mhagreementhand, wm_setfont, (wparam) hnewfont, 1 );
2. For background color issues, simply return a black image in the wm_ctlcolorstatic message of the parent window.
Hbrush HBr = (hbrush) getstockobject (black_brush );
Return (lresult) HBr;
Function body
HWND CreateWindow(
LPCTSTR lpClassName, // pointer to registered class name
LPCTSTR lpWindowName, // pointer to window name
DWORD dwStyle, // window style
int x, // horizontal position of window
int y, // vertical position of window
int nWidth, // window width
int nHeight, // window height
HWND hWndParent, // handle to parent or owner window
HMENU hMenu, // handle to menu or child-window identifier
HANDLE hInstance, // handle to application instance
LPVOID lpParam // pointer to window-creation data
);