用图形绘制字符串 c#
Drawing String with Graphics c#
如何在c#中绘制带有图形的字符串?我尝试使用此代码,但它不起作用。谢谢
g.DrawString("STRING", new Font(this.Font, FontStyle.Bold),
new Brush(), new Point(100, 100));
错误:
Error 1 Cannot create an instance of the abstract class or interface 'System.Drawing.Brush' C:\Users\Mihai\AppData\Local\Temporary Projects\Graphics Drawtext\Form1.cs 33 73 Graphics Drawtext
您必须创建具体的而不是抽象的 Brush
- 例如 SolidBrush
(或您选择的任何其他)。
请参阅 MSDN 以获取您可以使用的画笔实现列表(类 派生自 Brush
)。
如何在c#中绘制带有图形的字符串?我尝试使用此代码,但它不起作用。谢谢
g.DrawString("STRING", new Font(this.Font, FontStyle.Bold),
new Brush(), new Point(100, 100));
错误:
Error 1 Cannot create an instance of the abstract class or interface 'System.Drawing.Brush' C:\Users\Mihai\AppData\Local\Temporary Projects\Graphics Drawtext\Form1.cs 33 73 Graphics Drawtext
您必须创建具体的而不是抽象的 Brush
- 例如 SolidBrush
(或您选择的任何其他)。
请参阅 MSDN 以获取您可以使用的画笔实现列表(类 派生自 Brush
)。