Make Combobox font monospace in Find dialog

Close #5920, fix #3361, close #6001
This commit is contained in:
Don HO 2019-08-04 16:43:40 +02:00
parent dd401f1379
commit c35a2b5708
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
2 changed files with 27 additions and 0 deletions

View File

@ -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;

View File

@ -376,6 +376,7 @@ private :
StatusBar _statusBar;
FindStatus _statusbarFindStatus;
HFONT _hMonospaceFont = nullptr;
void enableReplaceFunc(bool isEnable);