zoukankan      html  css  js  c++  java
  • 滚动加载数据

    using DevExpress.XtraGrid.Views.Grid;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace demo1
    {
        /// <summary>
        /// 个人QQ群:298515749
        /// </summary>
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            /// <summary>
            /// 数据源
            /// </summary>
            DataTable dt = new DataTable();

            private void Form1_Load(object sender, EventArgs e)
            {
                dt.Columns.Add("A1");
                dt.Columns.Add("A2");
                dt.Columns.Add("A3");
                dt.Columns.Add("A4");
                gridControl1.DataSource = dt;
            }

            #region 无数据时显示样式
            private void gridView1_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
            {
                if (gridView1.RowCount == 0)
                {
                    string str = "没有绑定数据,双击可绑定数据!";
                    Font f = new Font("华文新魏", 14, FontStyle.Italic);
                    Rectangle r = new Rectangle(e.Bounds.Top + 5, e.Bounds.Left + 30, e.Bounds.Right - 5, e.Bounds.Height - 5);
                    e.Graphics.DrawString(str, f, Brushes.Blue, r);
                }
            }
            #endregion

            #region 双击绑定数据
            private void gridView1_Click(object sender, EventArgs e)
            {
                if (gridView1.RowCount == 0)
                {
                    for (int i = 0; i < 30; i++)
                    {
                        dt.Rows.Add("数据00" + i, "数据XX" + i, "数据MM" + i, "数据DD" + i);
                    }
                }
            }
            #endregion

            #region 滚动至底部加载下一页,这里为补加数据(无限滚动则无限补加)
            private void gridView1_TopRowChanged(object sender, EventArgs e)
            {
                if (gridView1.IsRowVisible(gridView1.RowCount - 1) == RowVisibleState.Visible)//判定是否到最后一行
                {
                    int count = gridView1.RowCount;
                    for (int i = 0; i < 30; i++)
                    {
                        dt.Rows.Add("数据00" + (i + count), "数据XX" + (i + count), "数据MM" + (i + count), "数据DD" + (i + count));
                    }
                }
            }
            #endregion

        }
    }

  • 相关阅读:
    Logistic 与 softmax
    opencv::KMeans图像分割
    opencv::KMeans方法概述
    opencv::opencv_traincascade.exe
    opencv::opencv_createsamples.exe
    opencv::视频人脸检测
    opencv实践::对象提取与测量
    opencv实践::透视变换
    opencv实践::对象计数
    opencv实践::对象的提取
  • 原文地址:https://www.cnblogs.com/liushunli/p/5295399.html
Copyright © 2011-2022 走看看