如何在程序中或安装软件时为系统增设一种(隶书)字体??(200分)

  • 主题发起人 主题发起人 dok001
  • 开始时间 开始时间
D

dok001

Unregistered / Unconfirmed
GUEST, unregistred user!
我的软件需要系统有隶书字体,并设置600X800显示;请问:<br>&nbsp; &nbsp; 1.如何在程序中或安装软件时为系统增设一种(隶书)字体??<br>&nbsp; &nbsp; 2.如何自动设置600X800显示.
 
1、将该字体拷贝到目录/Font下,即可<br>2、查本论坛即可知道
 
对1 ,程序中如何操作
 
注意注意,某些字体有版权的,不能乱copy
 
1、32位深度历险中有字体编程的源码<br>Delphi园地<br>http://mydelphi.8u8.com附书源码单元<br>2、<br>procedure SetResolution(ResX, ResY: DWord);<br>var<br>lDeviceMode : TDeviceMode;<br>begin<br>EnumDisplaySettings(nil, 0, lDeviceMode);<br>lDeviceMode.dmFields:=DM_PELSWIDTH or DM_PELSHEIGHT;<br>lDeviceMode.dmPelsWidth :=ResX;<br>lDeviceMode.dmPelsHeight:=ResY;<br>ChangeDisplaySettings(lDeviceMode, 0);<br>end;<br>****************<br>implementation<br>const<br>&nbsp; ScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.}<br>&nbsp; ScreenHeight: LongInt = 600;<br><br>{$R *.DFM}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>var<br>&nbsp; i, OldFormWidth: integer;<br>begin<br>&nbsp; scaled := true;<br>&nbsp; if (screen.width &lt;&gt; ScreenWidth) then begin<br>&nbsp; &nbsp; OldFormWidth := width;<br>&nbsp; &nbsp; height := longint(height) * longint(screen.height) DIV ScreenHeight;<br>&nbsp; &nbsp; width := longint(width) * longint(screen.width) DIV ScreenWidth;<br><br>&nbsp; &nbsp; scaleBy(screen.width, ScreenWidth);<br>&nbsp; &nbsp; font.size := (Width DIV OldFormWidth) * font.size;<br>&nbsp; end;<br>end;<br><br><br>Then, you will want to have something that checks to see that &nbsp;the font<br>sizes are OK. &nbsp;Before you change the font's size, you &nbsp;would need to ensure<br>the object actually has a font property by checking the RTTI. &nbsp; This can be<br>done as follows:<br><br>USES TypInfo; &nbsp;{Add this to your USES statement.}<br><br>var<br>&nbsp; i: integer;<br>begin<br>&nbsp; for i := componentCount - 1 downto 0 do<br>&nbsp; &nbsp; with components do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; if GetPropInfo(ClassInfo, 'font') &lt;&gt; nil &nbsp;then<br>&nbsp; &nbsp; &nbsp; &nbsp; font.size := (NewFormWidth DIV OldFormWidth) * font.size;<br><br>&nbsp; &nbsp; end;<br>end;<br>
 
<br>不要强制设置用户的显示尺寸,有些用户喜欢640<br>有些喜欢1024等等,除非你用“地雷磕头”做游戏,<br>不然....。<br>你有看见过强制切换屏幕分辨率的应用程序吗?
 
to yczjs: 在附书源码单元的什么地方,是不是灵感设计范例源代码的哪一个?<br>&nbsp; &nbsp; 我的程序有一处只能用隶书才能正常显示,椐我知,win98都带有隶书字体,不知为何<br>有的机子没有装,有无办法程序中或安装时替他直接装入隶书字体.<br>to leeeeleeee:是提供一种选择.
 
《delphi深度历险》中有有对字体的讨论,p347 &lt;带着字体走&gt; 中应该可以符合你的要求,<br>将字体放入执行程序中,这样即使是英文版的操作系统也可以显示你的隶书字体了。(不<br>过我没试过:)<br>设置屏幕分辨率:(摘抄至以前的帖子)<br>function Resolution(X,Y:word):boolean;<br>var<br>&nbsp; DevMode:TDeviceMode;<br>&nbsp; begin<br>&nbsp; &nbsp; Result:=EnumDisplaySettings(nil,0,DevMode);<br>&nbsp; &nbsp; if Result then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; DevMode.dmFields:=DM_PELSWIDTH Or DM_PELSHEIGHT;<br>&nbsp; &nbsp; &nbsp; DevMode.dmPelsWidth:=X;<br>&nbsp; &nbsp; &nbsp; DevMode.dmPelsHeight:=Y;<br>&nbsp; &nbsp; &nbsp; Result:=ChangeDisplaySettings(DevMode,0)=DISP_CHANGE_SUCCESSFUL;<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp; if Resolution(800,600) then ShowMessage('800×600模式!');<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>&nbsp; if Resolution(1280,1024) then ShowMessage('1280X1024模式!');<br>end;<br><br>procedure TForm1.Button3Click(Sender: TObject);<br>begin<br>&nbsp; if Resolution(1024,768) then ShowMessage('1024X768模式!');<br>end;
 
请问,你的三个按钮功能是什么?<br>&nbsp; &nbsp; 程序是判别还是设置?
 
昏...<br>Resolution是变换分辨率,你自己试试不就知道了<br>继续fainting...
 
我的意思是在create中变换分辨率不就行了?
 
是啊,已经给你函数了,程序是你在写啊,要在哪里变换就在哪里变换啊<br>唉...<br>对了,记住最后程序结束在变回来
 
请教:小虫:<br>&nbsp; &nbsp;变换分辨率时,屏幕闪动,抖动厉害吗?
 
建议:不要强制转换分辩率,你可用if语句,自己设置不同分辨率下显示效果!
 
win98没有隶书,office才有,只有自己copy一个到font目录。
 
接受答案了.
 
后退
顶部