如何得到系统的默认字体?(100分)

  • 主题发起人 主题发起人 马晓光
  • 开始时间 开始时间

马晓光

Unregistered / Unconfirmed
GUEST, unregistred user!
如何得到系统的默认字体?我查过API,但没找到。我现在只是强行让程序用“新宋体”,
但是如果是英文系统就不行了。请帮忙!谢谢!
 
Screen对象不行吗?它有MenuFont/IconFont/HintFont和Fonts,应该可以满足你的要求吧?
 
Let me try it, see you later.
 
各位朋友:

; ; 我试过了你们的方法,但是Screen.Font好像是类出所有的系统支持的字体,
而我想要的是当前系统默认字体,还请各位帮忙!
 
读注册表吧!!!!!

找本REG的书看看,里面肯定有的,然后用Delphi的方法读出来。。
 
zzWind,我没找到GetSysFont这个函数,请写明具体的位置。谢谢。
 
MSDN里面找找getfont
 
www.microsoft.com/msdn ;搜索system font
 
; ;MSDN Home > ;MSDN Library > ;Application Compatibility > ;Application Compatibility Guide > ;Best Practices When Designing for Application Compatibility > ;User Interface ;
;
Platform SDK: Application Compatibility Guide

Use DIALOGEX to Have the System Font
Windows 2000 uses a different system font than Windows NT 4.0 and Windows 95/98. To have your application use the system font no matter which system it is running on, use DS_SHELLFONT with the typeface MS Shell Dlg, and use the DIALOGEX resource instead of the DIALOG resource. The system maps this typeface such that your dialog box uses the Tahoma font on Windows 2000 and the MS Sans Serif font on earlier systems. DS_SHELLFONT has no effect if the typeface is not MS Shell Dlg.

Starting with Windows 2000, if you specify the Dialog Box Template Style to DS_SHELLFONT you can change the font size but you can no longer change the font face. For more information, see Dialog Box Templates.


Platform SDK Release: November 2001 ;What did you think of this topic?
Let us know. ;Order a Platform SDK CD Online
(U.S/Canada) ; (International)

;
;
;Contact Us ; | ;E-Mail this Page ; | ;MSDN Flash Newsletter ;
;© 2002 Microsoft Corporation. All rights reserved. ; Terms of Use ;Privacy Statement ; Accessibility ;
 
; ;MSDN Home > ;MSDN Library > ;Embedded Development > ;Default Registry Settings > ;Font Registry Settings ;
Microsoft Platform Builder 4.0 ;

System Font
[This topic is part of a beta release and is subject to change in future releases. Blank topics are included as placeholders.]

For more information about these registry settings, see various subtopics under Replacing Fonts.

[HKEY_LOCAL_MACHINE/SYSTEM/GDI/SYSFNT] ; System font
; "Nm"="Tahoma" ; Font name
; "Ht"=dword:e ; Font height
; "It"=dword:0 ; Font italic (0 or 1)
; "Wt"=dword:190 ; Font weight (boldness)
; "CS"=dword:0 ; Font characer set

[HKEY_LOCAL_MACHINE/SYSTEM/GWE/Menu/BarFnt] ; Menu bar font
; "Nm"="Tahoma"
; "Ht"=dword:e
; "It"=dword:0
; "Wt"=dword:LOC_MENUBARFONTWEIGHT
; "CS"=dword:0

[HKEY_LOCAL_MACHINE/SYSTEM/GWE/Menu/PopFnt] ; Popup menu font
; "Nm"="Tahoma"
; "Ht"=dword:e
; "It"=dword:0
; "Wt"=dword:190
; "CS"=dword:0

[HKEY_LOCAL_MACHINE/SYSTEM/GWE/OOMFnt] ; Out-of-memory dialog font
; "Nm"="Tahoma"
; "Ht"=dword:e
; "It"=dword:0
; "Wt"=dword:190
; "CS"=dword:0

[HKEY_LOCAL_MACHINE/SYSTEM/GWE/Menu]
; "BarTMrg"=dword:2
; "SepHt": REG_DWORD ; total height of a menu separator
; "SepXMrg": REG_DWORD ; margin of white space to the left of the menu separator line
; "SepYMrg": REG_DWORD ; margin of white space above the menu separator line
; "BarLMrg": REG_DWORD ; margin of white space to the left of one menu bar item>
; "BarRMrg": REG_DWORD ; margin of white space to the right of one menu bar item
; "BarTMrg": REG_DWORD ; margin of white space above a menu bar item
; "cmsScrl": REG_DWORD ; scrolling menu scroll period in milliseconds
; "Page": REG_DWORD ; number of up arrows that equal a PageUp (same as for down)
; "Overlap": REG_DWORD ; number of pixels between a parent menu and its cascading menu when using overlapping cascading menus (component mOverlap). Default is 60.>

[HKEY_LOCAL_MACHINE/SYSTEM/GWE/Button] ; Text weight for the button font
; "FontWeight"=dword:LOC_BUTTONFONTWEIGHT


Built on Friday, July 27, 2001

;
;Contact Us ; | ;E-Mail this Page ; | ;MSDN Flash Newsletter ;
;© 2002 Microsoft Corporation. All rights reserved. ; Terms of Use ;Privacy Statement ; Accessibility ;
 
Screen.HintFont 就是系统font
 
理由是: TStatusBar.UseSystemFont:=true的时候,它就是使用了 Screen.HintFont
 
用一列表框,add加入screen.hintfont
 
Hint

是可以随便 改的
//背景图片 的 hint
//半透明 ;的 hint
 
在你自己改掉hintfont之前的就是系统font,如果你自己没改,那它就是系统font
 
//我还是喜欢 以下
procedure TForm1.BitBtn1Click(Sender: TObject);
var
;i: TFont;
begin
i:= TFont.Create;
end;
 
//喜欢的原因

constructor TFont.Create;
begin
; DefFontData.Handle := 0;
; FResource := FontManager.AllocResource(DefFontData);
; FColor := clWindowText;
; FPixelsPerInch := ScreenLogPixels;
end;
 
后退
顶部