Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
鉴于这样的事情:
thefont = New Font("Courier New", fontheight)
和这个:
' g is a Graphics object
g.DrawString("some text", thefont, Brushes.Black, X, Y)
我可以在两者中间放置什么来更改字体的宽度,以便“某些文本”水平扩展或压缩但高度保持不变?
您可以使用比例变换来做到这一点,如下所示:
Matrix m = new Matrix(); m.Scale(3, 1); g.Transform = m; g.DrawString("Some text", this.Font, Brushes.Black, new PointF(10, 10)); g.ResetTransform();