求一个函数(在线等待)(50分)

  • 主题发起人 主题发起人 smiles_yin
  • 开始时间 开始时间
S

smiles_yin

Unregistered / Unconfirmed
GUEST, unregistred user!
如果用drawtext多行居中怎么做?还有其他的方法吗?希望给出例子,谢谢!
 
我也想知道的。
 
<br>R:Trect;<br>drawtext(canvas.handle,pchar(..........),-1,R,dt_wordbreak or ct_center);
 
to 52free<br>&nbsp; 麻烦你可以给我一个完整一点的吗?
 
建立个单元,放个按钮,然后用下面的替换掉那个unit单元即可<br>unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; canvas.Brush.Style:=bsSolid;<br>&nbsp; canvas.Brush.Color:=clwhite;<br>&nbsp; canvas.FillRect(canvas.cliprect);<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var R:Trect;<br>&nbsp; &nbsp; s:string;<br>begin<br>&nbsp; &nbsp; s:='this is delphi''s drawtext programe';<br>&nbsp; &nbsp; canvas.Font.Size:=12;<br>&nbsp; &nbsp; R:=Rect(10,10,80,100);<br>&nbsp; &nbsp; canvas.Rectangle(r.Left-2,r.Top-2,r.Right+2,r.Bottom+2);<br>&nbsp; &nbsp; drawtext(canvas.Handle,pchar(s),-1,R,dt_wordbreak or dt_center);<br>end;<br><br>end.
 
首先感谢52free,这个好象和我要的功能还有一定的距离,我要的是能实现EXCEL的那种文字居中方式,水平和垂直居中同时有!
 
这只是在参数型式上的组合改变<br>按住ctrl点dt_center<br>找出不同类型的参数组合起来试试
 
后退
顶部