加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何更改Delphi XE6 IDE的字体大小

发布时间:2020-12-15 09:50:36 所属栏目:大数据 来源:网络整理
导读:如何更改Delphi XE6的IDE本身的字体大小. IDE的对话框没有使用我的Windows字体首选项,我找不到任何更改IDE使用的字体的选项. 或者,how do i get Delphi XE6 to honor the user’s font preferences? 解决方法 你不能 字体是硬编码的.你无法改变它. 这是我尝
如何更改Delphi XE6的IDE本身的字体大小.

IDE的对话框没有使用我的Windows字体首选项,我找不到任何更改IDE使用的字体的选项.

或者,how do i get Delphi XE6 to honor the user’s font preferences?

解决方法

你不能
字体是硬编码的.你无法改变它.

这是我尝试过的

1 – 使用HEX编辑器更改BDS.EXE

如果在HEX编辑器中打开BDS.EXE,请查找TextHeight并将值从$0D(13)更改为更大的值,然后更改的bds.exe将看起来完全相同.

2 – 使用EnumChildWindows使用WM_SETFONT消息向Delphi IDE发送垃圾邮件

您可以将WM_SETFONT消息发送到正在运行的Delphi主窗口.
您必须使用FindWindow API调用找到该窗口.

来自: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.

因为您希望Delphi使用默认字体,所以消息非常简单.

Delphi XE6主窗口称为TAppBuilder,因此您必须使用FindWindow获取该窗口的句柄.

我尝试了这个,但它没有用.

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.

我没有尝试过默认字体,因为Delphi字体和默认字体在我的系统上是相同的.而且我不想更改默认字体.

这样做改变了我的Delphi上的2个dropdown_boxes.不是很好的表现.

我发布了这个答案,希望你能从这里找到解决方案.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读