ボタンの場所(インターチェンジの場所)をクリックしたときに黒いボタンに置き換えたいのですが、それは黒いボタンの隣にあります(b9 =黒いボタンで、lable1は場所を保存するための一時です)。
私はこの方法を作りました:
void checkLocation()
{
if (ActiveControl.Location == new Point(5, 7))//-----------for button 1
{
if (b9.Location == new Point(83, 7) || b9.Location == new Point(5, 71))
{
label1.Location = ActiveControl.Location;
ActiveControl.Location = b9.Location;
b9.Location = label1.Location;
}
}// it continue for every button
そして、すべてのボタンクリックに対してこのコードを書きます
private void button1_Click(object sender, EventArgs e)
{
checkLocation();
}
現在、一部のボタンが現在機能しません。なにが問題ですか ?