通过 API 函数更改字体过程。
解决方案 »
- 请教关于image控件上,实现填充三角形的方法?
- 发贴,求募捐可用分,感谢。
- 寻找一个控件 100分求
- oracle 中sql语句问题
- 如何去掉导入txt文本的结束符(#0)?
- 关于TList的问题,请各位帮忙.
- 两个问题解决后一个300分一个190分绝不食言
- $发月份工资
- 有表T1,字段有code(char 6),cname(char 15),ck(int),当使用CODE,CK条件时
- 大家谁知道delphi利用用什么控件可以模拟甘特图(类似project中相关功能)?
- 当有某进程的ID或此进程某窗口的句柄handle时,如何得到此进程的application的句柄handle?
- 请教高手 ListBox 怎么可以加横向滚动条? 谢谢!
var
DC: HDC;
Save: THandle;
Metrics: TTextMetric;//米制,单位
AveCW, MaxCW: Integer;
begin
DC := GetDC(0);//取得本窗体字体控制柄
Save := SelectObject(DC, Value.Handle);
GetTextMetrics(DC, Metrics);取得当前字体的单位。
SelectObject(DC, Save);
ReleaseDC(0, DC);
with Metrics do
begin
AveCW := tmAveCharWidth;//平均字符宽度
MaxCW := tmMaxCharWidth;//最大字符宽度
end;
case AveCW = MaxCW of
True: inherited Font := Value;
False:
begin
with fFontDummy do
begin
Color := Value.Color;//下面就不说
Pitch := fpFixed;
Size := Value.Size;
Style := Value.Style;
end;
inherited Font := fFontDummy;
end;
end;
end;
procedure TmwCustomEdit.FontChanged(Sender: TObject);
var
DC: HDC;
Save: THandle;
Metrics: TTextMetric;
begin
DC := GetDC(0);
Save := SelectObject(DC, Font.Handle);
GetTextMetrics(DC, Metrics);
SelectObject(DC, Save);
ReleaseDC(0, DC);
with Metrics do
begin
fCharWidth := tmAveCharWidth;
fTextHeight := tmHeight + tmExternalLeading;
if PaintLock = 0 then Invalidate;
end;
end;