我正在尝试将此 WinForms 代码移至 WPF,但没有任何Paint
事件。
private void OnPaint(object sender, PaintEventArgs e)
{
var region = new Region(new Rectangle(0, 0, this.Width, this.Height));
var rectangle = new Rectangle(0, 0, 50, 50);
region.Xor(rectangle);
e.Graphics.FillRegion(Brushes.Black, region);
}