以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  文字居中,不会了  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=140789)

--  作者:有点蓝
--  发布时间:2019/9/15 15:58:00
--  
这个有点麻烦,需要计算文字占用的宽度,试试

dim w2 as integer = e.Graphics.MeasureString(msgfnt).width
x = e.x + (e.Width - w2)/2
e.Graphics.DrawString(msg,fnt,br,x + 1,e.y + 4)