Note that there are some explanatory texts on larger screens.

plurals
  1. POdragging issue in chess table
    primarykey
    data
    text
    <p>I have chess table and my elements are now moving according to rules .But when I drag out of rules my button is disappearing...How I can solve it ??? (red buttons are showing where can I go my elements) for example knight is moving as rules now (if I don't pass over the red buttons there is no problem)but when I pass over the red places and if I drop there the knight disappears and red places turns back to their original color ( no more red places which indicates where my knight can go ). i tried to make debug but since i am new in c# and debugging i haven't solved the problem. i will be happy if u enlighten my way. how can i solve it? thanks </p> <pre><code> void btn_DragEnter(object sender, DragEventArgs e) { Button button = (Button)sender; e.Effect = DragDropEffects.Move; for (int x = 0; x &lt;= 7; x++) { for (int y = 0; y &lt;= 7; y++) { btn[x, y].Image = null; if ((x + y) % 2 == 0) btn[x, y].BackColor = Color.Black; else btn[x, y].BackColor = Color.White; } } } void btn_DragDrop(object sender, DragEventArgs e) { Button button = (Button)sender; button.Image = (Bitmap)e.Data.GetData(DataFormats.Bitmap); int[] dizi = (int[])button.Tag; int x = dizi[0]; int y = dizi[1]; for (int a = 0; a &lt;= 7; a++) { for (int b = 0; b &lt;= 7; b++) { btn[a, b].AllowDrop = false; } } if ((x + 1 &gt;= 0 &amp;&amp; y + 2 &lt;= 7) &amp;&amp; (y + 2 &gt;= 0 &amp;&amp; x + 1 &lt;= 7)) { btn[x + 1, y + 2].BackColor = Color.Red; btn[x + 1, y + 2].AllowDrop = true; } if ((x + 1 &gt;= 0 &amp;&amp; y - 2 &lt;= 7) &amp;&amp; (y - 2 &gt;= 0 &amp;&amp; x + 1 &lt;= 7)) { btn[x + 1, y - 2].BackColor = Color.Red; btn[x + 1, y - 2].AllowDrop = true; } if ((x - 1 &gt;= 0 &amp;&amp; y + 2 &lt;= 7) &amp;&amp; (y + 2 &gt;= 0 &amp;&amp; x - 1 &lt;= 7)) { btn[x - 1, y + 2].BackColor = Color.Red; btn[x - 1, y + 2].AllowDrop = true; } if ((x - 1 &gt;= 0 &amp;&amp; y - 2 &lt;= 7) &amp;&amp; (y - 2 &gt;= 0 &amp;&amp; x - 1 &lt;= 7)) { btn[x - 1, y - 2].BackColor = Color.Red; btn[x - 1, y - 2].AllowDrop = true; } if ((x + 2 &gt;= 0 &amp;&amp; y + 1 &lt;= 7) &amp;&amp; (y + 1 &gt;= 0 &amp;&amp; x + 2 &lt;= 7)) { btn[x + 2, y + 1].BackColor = Color.Red; btn[x + 2, y + 1].AllowDrop = true; } if ((x + 2 &gt;= 0 &amp;&amp; y - 1 &lt;= 7) &amp;&amp; (y - 1 &gt;= 0 &amp;&amp; x + 2 &lt;= 7)) { btn[x + 2, y - 1].BackColor = Color.Red; btn[x + 2, y - 1].AllowDrop = true; } if ((x - 2 &gt;= 0 &amp;&amp; y + 1 &lt;= 7) &amp;&amp; (y + 1 &gt;= 0 &amp;&amp; x - 2 &lt;= 7)) { btn[x - 2, y + 1].BackColor = Color.Red; btn[x - 2, y + 1].AllowDrop = true; } if ((x - 2 &gt;= 0 &amp;&amp; y - 1 &lt;= 7) &amp;&amp; (y - 1 &gt;= 0 &amp;&amp; x - 2 &lt;= 7)) { btn[x - 2, y - 1].BackColor = Color.Red; btn[x - 2, y - 1].AllowDrop = true; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload