Write info about the clipping rectangle to the console window
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class Form1 : Form {
protected override void OnPaint(PaintEventArgs e) {
Graphics g = e.Graphics;
g.FillRectangle(Brushes.White, this.ClientRectangle);
String s = "text";
Font f = new Font("Times New Roman", 12);
SizeF sf = g.MeasureString(s, f, 400);
RectangleF rf = new RectangleF(10, 10, sf.Width, sf.Height);
g.DrawString(s, f, Brushes.Black, rf);
f.Dispose();
Console.WriteLine("Clipping region painted: " + e.ClipRectangle);
}
public static void Main() {
Application.Run(new Form1());
}
}