case WM_CTLCOLOREDIT: { HWND hShellText = GetDlgItem(hDlg,IDC_TXT_SHELL); if (hShellText == (HWND)lParam) { HDC hdc = (HDC)wParam; SetTextColor(hdc,RGB(0,255,0)); SetBkColor(hdc,RGB(0,0,0)); } return(INT_PTR) GetSysColorBrush(COLOR_BACKGROUND); } break;
响应以上消息,就可以得到 黑底 绿字的像个dos窗口的editctrl了,字体还不太像,下面在设置下字体
static HFONT hFont = CreateFont(18, // nHeight 0, // nWidth 0, // nEscapement 0, // nOrientation FW_MEDIUM, // nWeight false, // bItalic FALSE, // bUnderline 0, // cStrikeOut DEFAULT_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH | FF_SWISS, _T("Courier") //Terminal Courier // nPitchAndFamily ); HWND hShellText = GetDlgItem(hwnd,IDC_TXT_SHELL); SendMessage(hShellText,WM_SETFONT,(WPARAM)hFont,true);
这样就像多了
时间: 2024-10-22 03:08:12