111,129
社区成员
发帖
与我相关
我的任务
分享
public partial class Form1 : Form
{
Region m_Region;
public Form1()
{
InitializeComponent();
// The rectangle in the picture box
Region rec1 = new Region(new Rectangle(10, 10, 30, 30));
// The picture box region
Region rec2 = new Region(pictureBox1.ClientRectangle);
// Get the region out of the retangle
rec2.Xor(rec1);
m_Region = rec2;
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.FillRegion(Brushes.Red, m_Region);
}
}