programming-examples/c-sharp/Others/Use Font from Form to paint string on a form.cs
2019-11-15 12:59:38 +01:00

22 lines
539 B
C#

Use Font from Form to paint string on a form
using System;
using System.Drawing;
using System.Windows.Forms;
class InheritHelloWorld : Form {
public static void Main() {
Application.Run(new InheritHelloWorld());
}
public InheritHelloWorld() {
Text = "Inherit " + Text;
}
protected override void OnPaint(PaintEventArgs pea) {
Graphics graphics = pea.Graphics;
graphics.DrawString("I Love Clementine",
Font, Brushes.Black, 0, 100);
}
}