Changing font in CHOOSECOLOR dialog
I'm using the Windows common c开发者_Go百科ontrols CHOOSECOLOR dialog, but on Win 7 it sticks out like a sore thumb as it still uses the 'old' Tahoma font.
Is there a fairly easy way of getting it to use Segoe UI or some other font?
If it matters, I'm using Delphi/C++Builder...
I don't think it is a good idea to alter the default font, but sure, it's 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 Form1.Font
font.
Still, in this case, I might just find it acceptable:
Tahoma (Default) vs. Segoe UI
But! There are issues involved:
The safest thing to do, I think, is not to alter the default (intended) appearance of the dialog. Then, at least, you can blame Microsoft for any scaling issues...
精彩评论