fontdialog 里有系统所有可用的字体以及字体所对应的大小尺寸,我想把字体名和对应大小分别显示在两个combobox里用来控制编辑界面显示, 因为不想每次设置的时候都要打开fontdialog. 字体名已经可以取到,但不知道字体所对应大小如何取得到。 还有象宋体五号字体该如何设置,(不是用fontdialog来设置,fontdialog设置好的font属性直接赋值给别的控件的font属性我知道)
解决方案 »
- 求助:将Excel中数据导入SQL Server中时遇到的问题
- 关于Delphi操作Excel表的一些问题,有很多疑问,但不太难,恳请大家帮忙,谢谢了。。。。。。
- 一个菜鸟的简单问题,还请大家解答
- 怎样通过函数FileWrite把字符串变量的内容写到文件中去???
- 100分求问关于流水号的简单问题!!!
- 有关TChart的问题?
- 在sql里面显示0.78,在delphi里面却显示0.782214324??
- Delphi+win2000+Sqlserver2000开发想发布到客户:win98+msde可以吗?急急急....
- 文件夹问题(放分)
- Ado在Delphi中的查询速度问题
- DCOM老问题
- 如何改变外部richedit20A类型窗口的字体大小和颜色
begin
cFontName := FontDialog1.Font.Name;
cFontStyle:= FontStyleToString(FontDialog1.Font);
cFontColor := FontDialog1.Font.Color;
cFontSize := FontDialog1.Font.Size;
end;然后自己添加到指定的combobox里即可。
这里唯一需要特殊处理的就是style,不过也不难。给你个参考。function FontStyleToString(Font: TFont):string;
var
sStyle: string;
begin
with Font do
begin
sStyle := ''; if (fsBold in Style) then
sStyle := sStyle + csfsBold; if (fsItalic in Style) then
sStyle := sStyle + csfsItalic; if (fsUnderline in Style) then
sStyle := sStyle + csfsUnderline; if (fsStrikeOut in Style) then
sStyle := sStyle + csfsStrikeout; if ((Length(sStyle) > 0) and ('|' = sStyle[1])) then
sStyle := Copy(sStyle, 2, Length(sStyle) - 1); Result := Format('"%s", %d, [%s]',[name, Size, sStyle]);
if bIncludeColor then
Result := Result + Format(', [%s]',[ColorToString(Color)]);
end;
end;