diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index e58ace31..7e5477ab 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -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; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index c4babc36..65e1f3a4 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -376,6 +376,7 @@ private : StatusBar _statusBar; FindStatus _statusbarFindStatus; + HFONT _hMonospaceFont = nullptr; void enableReplaceFunc(bool isEnable);