public void ApplyRegion()
{
var r = new Region(new Rectangle(0, 0, MaskImage.Width, MaskImage.Height));
for (int y = 0; y < MaskImage.Height; y++)
for (int x = 0; x < MaskImage.Width; x++)
{
if (MaskImage.GetPixel(x, y) == TransparencyKey)
{
r.Exclude(new Rectangle(x, y, 1, 1));
}
}
Control.Region = r;
Control.BackgroundImage = MaskImage;
}
}