关于DrawText的问题 (50分)

  • 主题发起人 主题发起人 ifeng
  • 开始时间 开始时间
I

ifeng

Unregistered / Unconfirmed
GUEST, unregistred user!
我画出的文字有时需要左中、中中、中下等对齐方式。<br>如果是单行还行,但如果是多行就不行了,如何解决多行纵向居中??<br>另外单行中下对齐不行<br>中下对齐:<br>&nbsp; &nbsp;DrawText(XCV.Handle,PChar(Text),Length(Text),R,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DT_SINGLELINE or<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DT_BOTTOM or<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DT_VCENTER or<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DT_WORDBREAK);<br>以上不能中下对齐(单行文字)。如何解决?<br>分不够可以加,要多少都行!<br><br>
 
定义<br>var<br>XCV : TMetafileCanvas;<br>R : Rect;<br>
 
你写错了[:)]<br>左中: DT_LEFT or DT_VCENTER<br>中中: DT_CENTER or DT_VCENTER<br>中下: DT_CENTER or DT_BOTTOM
 
多行居中呢,如何解决?
 
命苦啊!<br>自己写组件吧,TGraphicControl 。
 
时间来不及了<br>帮帮忙啊,很急!
 
多行把 DT_SINGLELINE 去掉就可以了<br>但多行时 DT_BOTTOM、DT_VCENTER、DT_TOP 无效<br>只能自己根据行数计算坐标来设定Rect最终达到目的
 
多人接受答案了。
 
后退
顶部