私は次のように長方形を描きました:
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: " ????);
}
}
前もって感謝します