惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

博客园 - qevan

QCanvasTextWriter structures显示的模块的bpl - qevan - 博客园 delphi跟踪调试vcl代码的方法 QTrayIcon v1.0B 根据delphi版本进行编译 在气泡式提示窗口中显示关闭按钮 zz 中国共享软件注册提供商的比较 Delphi中资源文件使用详解 zz ShowBalloonTips @ TrayIcon 如何在DELPHI程序中顯示Balloon工具提示﹖ zz 分割人名的代码 电话薄的AT指令 zz 读取中文电话簿 AT+CPMS指令的意义以及AT+CNMI自动接收短信时的方法 一篇短信at指令介绍的文章, 摘过来 短信相关文章的连接 16进制字符转换为10进制 delphi c#的PDU-SMS编程代码 zz Delphi 2005纯WIN32开发环境
把字体保存到注册表或流中
qevan · 2005-04-18 · via 博客园 - qevan
把字体保存到注册表或流中
[ 作者:hubdog    转贴自:本站原创    点击数:201    更新时间:2004-7-7    文章录入:delphilxh
type 
  FontRec = packed record 
    Color: TColor; 
    LogFont: TLogFont; 
  end; 

// Save a font to the registry 保存到注册表
procedure SaveFontToReg(reg: TRegistry; const key, id: string; Font: TFont); 
var 
  fRec: FontRec; 
begin 
  if Windows.GetObject(Font.Handle, SizeOf(fRec.LogFont), @fRec.LogFont) > 0 then 
  begin 
    if reg.OpenKey(key, True) then 
      try 
        fRec.Color := Font.Color; 
        reg.WriteBinaryData(id, fRec, SizeOf(fRec)); 
      finally 
        reg.CloseKey; 
      end; 
  end; 
end; 

// Load a font from the registry 读取注册表
procedure LoadFont(reg: TRegistry; const key, id: string; Font: TFont); 
var 
  fRec: FontRec; 
begin 
  if reg.OpenKey(key, False) then 
    try 
      if reg.ReadBinaryData(id, frec, SizeOf(fRec)) = SizeOf(fRec) then 
        Font.Handle := CreateFontIndirect(fRec.LogFont); 
      Font.Color := fRec.Color; 
    finally 
      reg.CloseKey; 
    end; 
end; 

// Save a font to a stream 保存到流
procedure WriteFontToStream(s: TStream; Font: TFont); 
var 
  fRec: FontRec; 
  sz: integer; 
begin 
  sz := SizeOf(fRec.LogFont); 
  if Windows.GetObject(Font.Handle, sz, @fRec.LogFont) > 0 then 
  begin 
    s.Write(sz, SizeOf(Integer)); 
    fRec.Color := Font.Color; 
    s.Write(fRec, SizeOf(fRec)); 
  end 
  else 
  begin 
    sz := 0; 
    s.Write(sz, SizeOf(Integer)); 
  end; 
end; 

// Read a font from a stream 从流中读出
procedure ReadFont(s: TStream; Font: TFont); 
var 
  fRec: FontRec; 
  sz: integer; 
begin 
  s.read(sz, SizeOf(Integer)); 
  if sz = SizeOf(fRec.LogFont) then 
  begin 
    s.read(fRec, SizeOf(fRec)); 
    Font.Handle := CreateFontIndirect(fRec.LogFont); 
    Font.Color  := fRec.Color; 
  end; 
end;