Ian Boyd
Ian Boyd

Reputation: 256721

How to change font size of Delphi XE6 IDE

How can i change the font size of the IDE itself of Delphi XE6.

The IDE's dialogs are not using my Windows font preference, and i cannot find any option to change the font used by the IDE.

enter image description here

Alternatively, how do i get Delphi XE6 to honor the user's font preferences?

Upvotes: 9

Views: 6070

Answers (2)

Artur_Indio
Artur_Indio

Reputation: 766

The best way to do that is using Delphi IDE Theme Editor, it's very simple. Try in Delphi IDE Theme Editor, preview:

enter image description here

Upvotes: 0

Johan
Johan

Reputation: 76567

You can't
The font is hardcoded. You cannot change it.

Here's what I've tried

1 - Change BDS.EXE with a HEX editor

If you open up BDS.EXE in a HEX-editor, look for TextHeight and change the values from $0D (13) to something bigger, then the altered bds.exe will look exactly the same.

2 - Use EnumChildWindows to spam the Delphi IDE with WM_SETFONT messages

You can send a WM_SETFONT message to the running Delphi main window.
You have to find the window using the FindWindow API call.

From: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632642%28v=vs.85%29.aspx

wParam
A handle to the font (HFONT). If this parameter is NULL, the control uses the default system font to draw text.
lParam
The low-order word of lParam specifies whether the control should be redrawn immediately upon setting the font. If this parameter is TRUE, the control redraws itself.

Because you want Delphi to use the default font, the message is really simple.

The Delphi XE6 main window is called TAppBuilder, so you'll have to get the handle to that Window using FindWindow.

I tried this, but it did not work.

unit Unit4;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm4 = class(TForm)
    FontDialog1: TFontDialog;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form4: TForm4;

implementation

{$R *.dfm}

const
  DelphiWindows: array [1 .. 1] of PWideChar = ('TAppBuilder');

function EnumChildProc(const hWindow: hWnd; const hFont: LParam): boolean; stdcall;
begin
  SendMessage(hWindow, WM_SETFONT, hFont, 1);
  Result:= True;
end;

procedure TForm4.Button1Click(Sender: TObject);
var
  BDSWindow: HWND;
  ChildWindow: HWnd;
  Font: HFONT;
  i: Integer;
begin
  if FontDialog1.Execute then begin
    BDSWindow:= FindWindow(DelphiWindows[1], nil);
    Font:= FontDialog1.Font.Handle;
    EnumChildWindows(BDSWindow, @EnumChildProc, Font);
    ShowMessage('Done');
  end;
end;

end.

I have not tried the default font, because the Delphi font and the default font are the same on my system. And I don't want to change the default font.

Doing this changed 2 dropdown_boxes on my Delphi. Not a very good showing.

I posted this as an answer in the hope that you can get to a solution from here.

Upvotes: 1

Related Questions