本文介绍了我的代码的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友,我写了一些代码来下棋游戏中的国王.您能告诉我国王不动的这段代码的问题在哪里吗?谢谢.
如果(pictureBox34.Image == Chess9.Properties.Resources.siyahsah2))
{
F();
}
公共 void picarray() { pic [ 0 , 4 ] = pictureBox34; }
公共 void f() { int x = 3 ; 模式=保持; int y = 3 ; for ( int i = 1 ; i < x; i ++) { for ( int j = 1 ; j < y; j ++) { pic [i,j] = pic [i + 1 ,j + 1 ]; pic [i,j] = pic [i- 1 ,j- 1 ]; } pic [i,j] .Image = Image.FromFile(" pic/siyahsah2.jpg" ); }
解决方案
Hi friends, I wrote some code to move the king in chess game; can you tell me where is the problem of this code that king doesn''t move? Thanks.
if (pictureBox34.Image == chess9.Properties.Resources.siyahsah2))
{
f();
}
public void picarray() { pic[0, 4] = pictureBox34; }
public void f() { int x = 3; mode = hold; int y = 3; for (int i = 1; i < x; i++) { for (int j = 1; j < y; j++) { pic[i, j] = pic[i + 1, j + 1]; pic[i, j] = pic[i - 1, j - 1]; } pic[i, j].Image = Image.FromFile("pic/siyahsah2.jpg"); }
解决方案
这篇关于我的代码的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!