1 private void label2_Paint(object sender, PaintEventArgs e) 2 {//绘制label中文字 3 string text = "Sri Lanka"; 4 Graphics g = e.Graphics; 5 Font font = new Font("Arial", 15); 6 Brush brush = new SolidBrush(Color.Black); 7 float lineSpacing = 0.5f; 8 9 SizeF size = g.MeasureString("A", font); 10 11 float pos = 0.0f; 12 for (int i = 0; i < text.Length; ++i) 13 { 14 string charToDraw = text.Substring(i, 1); 15 g.DrawString(charToDraw, font, brush, pos, 0.0f); 16 SizeF sizeChar = g.MeasureString(charToDraw, font); 17 pos += sizeChar.Width + size.Width * lineSpacing; 18 } 19 }