日期:2014-05-17  浏览次数:20878 次

C#winform在一个panel中固定3列4行的label控件,在数据库中拿到数据。如果数据大于12将做翻页,请问如何做呢?

 private void timer4_Tick(object sender, EventArgs e)
        {
            t++;
            this.sql = "select * from sales_tacken where place='" + place + "'";
            DataTable dt = DB.selectDT(DB.cn, this.sql);

            int count = dt.Rows.Count;
            if (count != 0)
            {
                int s = count % 12;
                if (s == 0)
                {
                    int pag = count / 12;
                    int clum = t % pag;

                    int tmp = 0;  //定义tmp这个要在for轮回外面定义 
                    if (dt != null)
                    {
                        panel3.Controls.Clear();
                        if (clum < pag) { pag = 12; } else { pag = s; }

                        int k = -1;
                        for (int i = clum * 12; i < clum * 12 + pag; i++)
                        {
                            k++;
                            int n = k % 3;
                            if (n == 0 && k != 0)
                       &n