1。空心字(只有外边缘的字,需要比较大的字号才能效果好 )
主要用了 GraphicsPath 类
GraphicsPath GetStringPath( string s, float dpi, RectangleF rect, Font font, StringFormat format)
{

GraphicsPath path = new GraphicsPath();
// Convert font size into appropriate coordinates
float emSize = dpi * font.SizeInPoints / 72;
path.AddString( s, font.FontFamily, (int)font.Style, emSize, rect, format);
return path;
}


private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
string s = "Outline";
RectangleF rect = this.ClientRectangle;
Font font = new Font("Arial", 32, GraphicsUnit.Point);
StringFormat format = StringFormat.GenericTypographic;
float dpi = g.DpiY;
using( GraphicsPath path = GetStringPath(s, dpi, rect, font, format) )
{
g.DrawPath(Pens.Black, path);
}
}
相关文章:
-
2021-08-28
-
2022-12-23
-
2021-09-27
-
2022-12-23
-
2021-11-11
-
2021-05-20
-
2022-12-23
-
2021-06-21
猜你喜欢
-
2022-02-18
-
2021-11-16
-
2021-06-22
-
2021-08-19
-
2021-07-28
-
2022-12-23
-
2022-12-23
相关资源
-
下载
2021-06-24
-
下载
2023-03-18
-
下载
2021-06-24