在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1Graphics g = this.CreateGraphics();
2SizeF sizeF = g.MeasureString("A", new Font("宋体", 9)); 3MessageBox.Show(sizeF.Width + " " + sizeF.Height); 4g.Dispose();
1 private void MeasureText1(PaintEventArgs e)
2 { 3 String text1 = "Measure this text"; 4 Font arialBold = new Font("Arial", 12.0F); 5 Size textSize = TextRenderer.MeasureText(text1, arialBold); 6 TextRenderer.DrawText(e.Graphics, text1, arialBold, 7 new Rectangle(new Point(10, 10), textSize), Color.Red); 8 } 9
|
请发表评论