应该为
for (int i=0;i<基本数据DataSet3.Tables [0].Rows .Count ;i++) 
                { 
                int TempInt = i%6;//取余数,计算横坐标用。
                int TempInt2= (int)i/6;//取整数,看放置在第几行。
                Button myButton = new Button(); 
                myButton.Size = new Size(20, 20); 
                myButton.Text = 基本数据DataSet3.Tables[0].Rows[i][0].ToString(); 
                myButton.Left = 0 + TempInt * 20; 
                myButton.Top = 0 + TempInt2 * 20; 
                this.panel2.Controls.Add(myButton); 
            }
谢谢思路

04-24 19:35
查看更多