我已经画了一个矩形:
Rectangle rectangle=new Rectangle(10,10,40,40);
g.FillRectangle(new SolidBrush(Color.Red),rectangle);
有人可以给我任何想法,点击时是否可以获得矩形的背景颜色:
private void Form1_MouseClick(object sender, MouseEventArgs e)
{
if (rectangle.Contains(e.Location))
{
//get the color here that it should be Red
Console.WriteLine("COLOR IS: " ????);
}
}
提前致谢