>修改菜单字体的大小:
读取
function GetMenuFontSize: Integer;
var
ncm: TNonClientMetrics;
PixelsPerInch: integer;
begin
ncm.cbSize := sizeof(TNonClientMetrics);
SystemParametersInfo(
SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS),
@ncm,
SPIF_UPDATEINIFILE
);
PixelsPerInch := GetDeviceCaps(GetDC(0), LOGPIXELSY);
Result := -MulDiv(ncm.lfMenuFont.lfHeight, 72, PixelsPerInch);
end;
{ 设置}
procedure SetMenuFontSize(FontSize: Integer);
var
ncm: TNonClientMetrics;
PixelsPerInch: Integer;
begin
ncm.cbSize := sizeof(TNonClientMetrics);
SystemParametersInfo(
SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS),
@ncm,
0
);
PixelsPerInch := GetDeviceCaps(GetDC(0), LOGPIXELSY);
ncm.lfMenuFont.lfHeight := -MulDiv(FontSize, PixelsPerInch, 72);
SystemParametersInfo(
SPI_SETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS),
@ncm,
SPIF_UPDATEINIFILE
);
end;