1、分页整体显示如下:
主要包括功能如下:
1)显示总页数、当前页数
2)向前,向后翻页功能
3)显示首页,显示最后一页功能
4)自定义跳转页面功能
2、页面设计部分(.Designer.cs文件):
partial class DGVPager { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region 组件设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.label5 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.linkLast = new System.Windows.Forms.Button(); this.linkFirst = new System.Windows.Forms.Button(); this.linkPrevious = new System.Windows.Forms.Button(); this.linkNext = new System.Windows.Forms.Button(); this.lblPageCount = new System.Windows.Forms.Label(); this.lblSept = new System.Windows.Forms.Label(); this.lblTotalCount = new System.Windows.Forms.Label(); this.lblCurrentPage = new System.Windows.Forms.Label(); this.btnGo = new System.Windows.Forms.Button(); this.txtPageNum = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // label5 // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("幼圆", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label5.Location = new System.Drawing.Point(196, 6); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(49, 14); this.label5.TabIndex = 264; this.label5.Text = "条记录"; // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("幼圆", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label3.Location = new System.Drawing.Point(1, 6); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(63, 14); this.label3.TabIndex = 263; this.label3.Text = "当前页:"; // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("幼圆", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Location = new System.Drawing.Point(145, 6); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(21, 14); this.label1.TabIndex = 261; this.label1.Text = "共"; // // linkLast // this.linkLast.Font = new System.Drawing.Font("幼圆", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkLast.Location = new System.Drawing.Point(410, 1); this.linkLast.Name = "linkLast"; this.linkLast.Size = new System.Drawing.Size(44, 23); this.linkLast.TabIndex = 260; this.linkLast.Text = ">>|"; this.linkLast.UseVisualStyleBackColor = true; this.linkLast.Click += new System.EventHandler(this.linkLast_Click); // // linkFirst // this.linkFirst.Font = new System.Drawing.Font("幼圆", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.linkFirst.Location = new System.Drawing.Point(255, 1); this.linkFirst.Name = "linkFirst"; this.linkFirst.Size = new System.Drawing.Size(44, 23); this.linkFirst.TabIndex = 259; this.linkFirst.Text = "|<<"; this.linkFirst.UseVisualStyleBackColor = true; this.linkFirst.Click += new System.EventHandler(this.linkFirst_Click); // // linkPrevious // this.linkPrevious.Font = new System.Drawing.Font("幼圆", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((