Make Combobox font monospace in Find dialog
Close #5920, fix #3361, close #6001
This commit is contained in:
parent
dd401f1379
commit
c35a2b5708
@ -246,6 +246,9 @@ FindReplaceDlg::~FindReplaceDlg()
|
||||
if (_2ButtonsTip)
|
||||
::DestroyWindow(_2ButtonsTip);
|
||||
|
||||
if (_hMonospaceFont)
|
||||
::DeleteObject(_hMonospaceFont);
|
||||
|
||||
delete[] _uniFileName;
|
||||
}
|
||||
|
||||
@ -790,6 +793,29 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
|
||||
HWND hFiltersCombo = ::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO);
|
||||
HWND hDirCombo = ::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO);
|
||||
|
||||
const TCHAR* fontName = _T("Courier New");
|
||||
const long nFontSize = 8;
|
||||
|
||||
HDC hdc = GetDC(_hSelf);
|
||||
|
||||
LOGFONT logFont = { 0 };
|
||||
logFont.lfHeight = -MulDiv(nFontSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
|
||||
_tcscpy_s(logFont.lfFaceName, fontName);
|
||||
|
||||
_hMonospaceFont = CreateFontIndirect(&logFont);
|
||||
|
||||
ReleaseDC(_hSelf, hdc);
|
||||
|
||||
SendMessage(hFindCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0));
|
||||
SendMessage(hReplaceCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0));
|
||||
SendMessage(hFiltersCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0));
|
||||
SendMessage(hDirCombo, WM_SETFONT, (WPARAM)_hMonospaceFont, MAKELPARAM(true, 0));
|
||||
|
||||
RECT arc;
|
||||
::GetWindowRect(::GetDlgItem(_hSelf, IDCANCEL), &arc);
|
||||
_findInFilesClosePos.bottom = _replaceClosePos.bottom = _findClosePos.bottom = arc.bottom - arc.top;
|
||||
|
@ -376,6 +376,7 @@ private :
|
||||
StatusBar _statusBar;
|
||||
FindStatus _statusbarFindStatus;
|
||||
|
||||
HFONT _hMonospaceFont = nullptr;
|
||||
|
||||
|
||||
void enableReplaceFunc(bool isEnable);
|
||||
|
Loading…
Reference in New Issue
Block a user