问题描述
在winform上画了很多pictruebox的控件,一行四个,一共两行,但是只能显示第一个和最后一个的图片,将其他的注释了之后再显示还是第一个和第八个问问怎么解决?
解决方案
解决方案二:
代码贴出来没代码的情况,个人估计是loction位置覆盖了当然我个人建议使用FlowlayeroutPanel,代替普通panel,这样就无需考虑location的位置了,只管control.add就是
解决方案三:
注意每个picturebox的location。
解决方案四:
引用1楼wanghui0380的回复:
代码贴出来没代码的情况,个人估计是loction位置覆盖了当然我个人建议使用FlowlayeroutPanel,代替普通panel,这样就无需考虑location的位置了,只管control.add就是
stringfptrain1=ds.Tables[0].Rows[arrayOrder[0]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain1);stringfptrain2=ds.Tables[0].Rows[arrayOrder[1]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain2);stringfptrain3=ds.Tables[0].Rows[arrayOrder[2]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain3);stringfptrain4=ds.Tables[0].Rows[arrayOrder[3]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain4);stringfptrain5=ds.Tables[0].Rows[arrayOrder[4]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain5);stringfptrain6=ds.Tables[0].Rows[arrayOrder[5]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain6);stringfptrain7=ds.Tables[0].Rows[arrayOrder[6]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain7);stringfptrain8=ds.Tables[0].Rows[arrayOrder[7]-1]["file_path"].ToString();this.pictureBox8.Image=Image.FromFile("E://character_whole//"+fptrain8);特别蠢的显示。。
解决方案五:
引用2楼guwei4037的回复:
注意每个picturebox的location。
location我在窗体显示界面看过了是对的。。
解决方案六:
额,这个请确保图像路径正确,同时需要设置一下picturebox滴sizemode,正常情况我一般设置为StretchImage或zoom当然具体情况你自己选择http://www.cnblogs.com/lv8218218/archive/2010/12/06/1897741.html
解决方案七:
调试看一下图片的路径是否正确。
解决方案八:
看这代码简直要犯密集恐惧症,能不能用数组,看着很简单估计就是文件不存在
解决方案九:
引用7楼tcmakebest的回复:
看这代码简直要犯密集恐惧症,能不能用数组,看着很简单估计就是文件不存在
真的存在。。但是就是显示不出来
解决方案十:
引用3楼lina181的回复:
Quote: 引用1楼wanghui0380的回复:
代码贴出来没代码的情况,个人估计是loction位置覆盖了当然我个人建议使用FlowlayeroutPanel,代替普通panel,这样就无需考虑location的位置了,只管control.add就是stringfptrain1=ds.Tables[0].Rows[arrayOrder[0]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain1);stringfptrain2=ds.Tables[0].Rows[arrayOrder[1]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain2);stringfptrain3=ds.Tables[0].Rows[arrayOrder[2]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain3);stringfptrain4=ds.Tables[0].Rows[arrayOrder[3]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain4);stringfptrain5=ds.Tables[0].Rows[arrayOrder[4]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain5);stringfptrain6=ds.Tables[0].Rows[arrayOrder[5]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain6);stringfptrain7=ds.Tables[0].Rows[arrayOrder[6]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain7);stringfptrain8=ds.Tables[0].Rows[arrayOrder[7]-1]["file_path"].ToString();this.pictureBox8.Image=Image.FromFile("E://character_whole//"+fptrain8);特别蠢的显示。。
这代码写的,估计是复制粘贴出来的吧?从stringfptrain2=ds.Tables[0].Rows[arrayOrder[1]-1]["file_path"].ToString();下面的这个picturebox改改名字就好了。第二到第七都是pictureBox1,只有第八个对了,当然只显示两个了。
解决方案十一:
引用9楼mjp1234airen4385的回复:
Quote: 引用3楼lina181的回复:
Quote: 引用1楼wanghui0380的回复:
代码贴出来没代码的情况,个人估计是loction位置覆盖了当然我个人建议使用FlowlayeroutPanel,代替普通panel,这样就无需考虑location的位置了,只管control.add就是stringfptrain1=ds.Tables[0].Rows[arrayOrder[0]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain1);stringfptrain2=ds.Tables[0].Rows[arrayOrder[1]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain2);stringfptrain3=ds.Tables[0].Rows[arrayOrder[2]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain3);stringfptrain4=ds.Tables[0].Rows[arrayOrder[3]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain4);stringfptrain5=ds.Tables[0].Rows[arrayOrder[4]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain5);stringfptrain6=ds.Tables[0].Rows[arrayOrder[5]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain6);stringfptrain7=ds.Tables[0].Rows[arrayOrder[6]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain7);stringfptrain8=ds.Tables[0].Rows[arrayOrder[7]-1]["file_path"].ToString();this.pictureBox8.Image=Image.FromFile("E://character_whole//"+fptrain8);特别蠢的显示。。
这代码写的,估计是复制粘贴出来的吧?从stringfptrain2=ds.Tables[0].Rows[arrayOrder[1]-1]["file_path"].ToString();下面的这个picturebox改改名字就好了。第二到第七都是pictureBox1,只有第八个对了,当然只显示两个了。
正解
解决方案十二:
引用10楼clxcxx的回复:
Quote: 引用9楼mjp1234airen4385的回复:
Quote: 引用3楼lina181的回复:
Quote: 引用1楼wanghui0380的回复:
代码贴出来没代码的情况,个人估计是loction位置覆盖了当然我个人建议使用FlowlayeroutPanel,代替普通panel,这样就无需考虑location的位置了,只管control.add就是stringfptrain1=ds.Tables[0].Rows[arrayOrder[0]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain1);stringfptrain2=ds.Tables[0].Rows[arrayOrder[1]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain2);stringfptrain3=ds.Tables[0].Rows[arrayOrder[2]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain3);stringfptrain4=ds.Tables[0].Rows[arrayOrder[3]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain4);stringfptrain5=ds.Tables[0].Rows[arrayOrder[4]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain5);stringfptrain6=ds.Tables[0].Rows[arrayOrder[5]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain6);stringfptrain7=ds.Tables[0].Rows[arrayOrder[6]-1]["file_path"].ToString();this.pictureBox1.Image=Image.FromFile("E://character_whole//"+fptrain7);stringfptrain8=ds.Tables[0].Rows[arrayOrder[7]-1]["file_path"].ToString();this.pictureBox8.Image=Image.FromFile("E://character_whole//"+fptrain8);特别蠢的显示。。
这代码写的,估计是复制粘贴出来的吧?从stringfptrain2=ds.Tables[0].Rows[arrayOrder[1]-1]["file_path"].ToString();下面的这个picturebox改改名字就好了。第二到第七都是pictureBox1,只有第八个对了,当然只显示两个了。
正解
噗!!!谢谢大神!本来准备改数组的!!!!真是想拍自己脑袋3q!!!!