I donβt think itβs a good idea to change the default font, but of course this is doable:
function EnumChildProc(hWnd: HWND; lParam: LPARAM): LongBool; stdcall; begin SendMessage(hWnd, WM_SETFONT, lParam, Integer(true)); result := true; end; procedure TForm1.ColorDialogShow(Sender: TObject); var dlg: TColorDialog; begin if not (Sender is TColorDialog) then Exit; dlg := TColorDialog(Sender); SendMessage(dlg.Handle, WM_SETFONT, Self.Font.Handle, Integer(true)); EnumChildWindows(dlg.Handle, @EnumChildProc, Self.Font.Handle); end; procedure TForm1.Button1Click(Sender: TObject); begin with TColorDialog.Create(nil) do try OnShow := ColorDialogShow; Execute(Handle); finally Free; end; end;
This will use the font Form1.Font
.
However, in this case, I could just find this acceptable:
Tahoma (default) and Segoe user interface
But! There is a problem:
I think the safest thing is not to change the default dialog box appearance. Then at least you can blame Microsoft for any scaling issues ...
Andreas Rejbrand
source share