如上,我使用e.Graphics.DrawString来写文字
我需要的效果是: 我是<-a字体 测试文字<-b字体
这两个是要连在一起的,因为我之后需要置中好设定的,请问有什么办法可以解决呢
如下:
e.Graphics.DrawString("我是测试文字", New Font("Futura Bk BT", 6, FontStyle.Regular), Brushes.Black, 170, 399)
dim x as integer = 50
dim y as integer = 50
dim s1 as string = "我是测试"
dim s2 as string = "文字"
dim font1 as font = new Font("Futura Bk BT", 6, FontStyle.Regular)
dim font2 as font = new Font("Futura Bk BT", 12, FontStyle.Bold)
dim block1 as sizef = g.MeasureString(s1, font1)
dim block2 as sizef = g.MeasureString(s2, font2)
e.Graphics.DrawString(s1, font1, Brushes.Black, x, y)
if (block1.Height < block2.Height) then y -= int(block2.Height - block1.Height)
e.Graphics.DrawString(s2, font2, Brushes.Black, x + block1.Width, y)