c# 绘图 Graphics 总结

//c# 获取屏幕 Graphics 
System.IntPtr DesktopHandle = GetDC(System.IntPtr.Zero);
Graphics g = Graphics.FromHdc(DesktopHandle);
//Graphic g.DrawString 绘制文本 区域居中
format.LineAlignment = StringAlignment.Center;  // 更正: 垂直居中
format.Alignment = StringAlignment.Center;      // 水平居中
 
RectangleF 排版框 = new Rectangle(Point.Zero, new Size(nWidth, nHeight));
g.DrawString(_ShowName, stringFont, Brushes.Black, 排版框, format);
 

 

posted @ 2022-07-15 09:18  devgis  阅读(802)  评论(0编辑  收藏  举报