c#winform怎么分页

伤逝的离别 2014-07-31 09:38:24
如图、第一页数据:
当timer时间控件3秒后画面切换到第二页:
这里是由于设定了每页5列,当数据超过5列的时候就切换到第二页继续显示,当超过10列就在第三页显示、如此类推

行数设定5的时候、:、
当时间控件为3秒后数据行数超过5行的那一列数据切换
这里绿色圈起来的数据是没有超过5行的,所以没发生改变;红色圈起来的超过5行所以发生改变

我只会显示一页的数据、要怎样才能达到上述的要求呢、?跪求大神帮忙、、
我的代码大概如下:
//设置行、列
int a=Convert.ToInt32(textbox1.Text);int k=Convert.ToInt32(textbox2.Text);
//翻页
public void make()
{
string sele = "select distinct tatler from tables";
DataSet dsyi = DbHelperSQL.ds(sele);
for (int i = 0; i < a); i++)
{
try
{
yisheng = new Label();
yisheng.Text = dsyi.Tables[0].Rows[i][0].ToString() ;
yisheng.Location = new Point(((Convert.ToInt16(ds.Tables[0].Rows[3][7]) - (yisheng.Width - 100)) / Convert.ToInt16(ds.Tables[0].Rows[3][10])) * i, 0);
panel2.Controls.Add(yisheng);
for (int j = 0; j < k - 1; j++)
{
string sele1 = string.Format("select shuju from Queue where Name='{0}' order by ID", dsyi.Tables[0].Rows[i][0]);
DataSet dshuan = DbHelperSQL.ds(sele1);
huanzhe = new Label();
huanzhe.Text =dshuan.Tables[0].Rows[k][0].ToString ()+" "+dshuan.Tables[0].Rows[j][1].ToString();
huanzhe.Location = new Point(yisheng.Location.X, ((Convert.ToInt16(ds.Tables[0].Rows[3][8]) - (yisheng.Height)) / Convert.ToInt16(ds.Tables[0].Rows[3][9]) * j) + 50);
panel2.Controls.Add(huanzhe);
}
}
catch
{ continue; }
}
...全文
167 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangnaisheng 2014-07-31
  • 打赏
  • 举报
回复

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧