Commit 083a6d02 HZH

修改表格控件,移除自适应高度和内置翻页控件

1 个父辈 34925690
正在显示 27 个修改的文件 包含 559 行增加357 行删除
......@@ -50,11 +50,12 @@ namespace HZH_Controls.Controls
{
this.components = new System.ComponentModel.Container();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.ucControlBase1 = new HZH_Controls.Controls.UCControlBase();
this.ucDataGridView1 = new HZH_Controls.Controls.UCDataGridView();
this.m_page = new HZH_Controls.Controls.UCPagerControl();
this.panel2 = new System.Windows.Forms.Panel();
this.txtSearch = new HZH_Controls.Controls.UCTextBoxEx();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.ucSplitLine_V2 = new HZH_Controls.Controls.UCSplitLine_V();
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
......@@ -75,23 +76,11 @@ namespace HZH_Controls.Controls
this.panel1.Size = new System.Drawing.Size(447, 333);
this.panel1.TabIndex = 4;
//
// panel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(5, 47);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(437, 15);
this.panel2.TabIndex = 1;
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// ucControlBase1
//
this.ucControlBase1.ConerRadius = 5;
this.ucControlBase1.Controls.Add(this.ucDataGridView1);
this.ucControlBase1.Controls.Add(this.m_page);
this.ucControlBase1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ucControlBase1.FillColor = System.Drawing.Color.Transparent;
this.ucControlBase1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
......@@ -109,6 +98,7 @@ namespace HZH_Controls.Controls
//
// ucDataGridView1
//
this.ucDataGridView1.AutoScroll = true;
this.ucDataGridView1.BackColor = System.Drawing.Color.White;
this.ucDataGridView1.Columns = null;
this.ucDataGridView1.DataSource = null;
......@@ -117,18 +107,37 @@ namespace HZH_Controls.Controls
this.ucDataGridView1.HeadHeight = 40;
this.ucDataGridView1.HeadPadingLeft = 0;
this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black;
this.ucDataGridView1.IsCloseAutoHeight = false;
this.ucDataGridView1.IsShowCheckBox = false;
this.ucDataGridView1.IsShowHead = true;
this.ucDataGridView1.Location = new System.Drawing.Point(5, 5);
this.ucDataGridView1.Name = "ucDataGridView1";
this.ucDataGridView1.Page = null;
this.ucDataGridView1.RowHeight = 30;
this.ucDataGridView1.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
this.ucDataGridView1.Size = new System.Drawing.Size(427, 256);
this.ucDataGridView1.Size = new System.Drawing.Size(427, 223);
this.ucDataGridView1.TabIndex = 0;
this.ucDataGridView1.TabStop = false;
//
// m_page
//
this.m_page.DataSource = null;
this.m_page.Dock = System.Windows.Forms.DockStyle.Bottom;
this.m_page.Location = new System.Drawing.Point(5, 228);
this.m_page.Name = "m_page";
this.m_page.PageCount = 0;
this.m_page.PageIndex = 1;
this.m_page.PageSize = 10;
this.m_page.Size = new System.Drawing.Size(427, 33);
this.m_page.StartIndex = 0;
this.m_page.TabIndex = 1;
//
// panel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(5, 47);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(437, 15);
this.panel2.TabIndex = 1;
//
// txtSearch
//
this.txtSearch.BackColor = System.Drawing.Color.Transparent;
......@@ -137,6 +146,7 @@ namespace HZH_Controls.Controls
this.txtSearch.DecLength = 2;
this.txtSearch.Dock = System.Windows.Forms.DockStyle.Top;
this.txtSearch.FillColor = System.Drawing.Color.Empty;
this.txtSearch.FocusBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.txtSearch.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtSearch.InputText = "";
this.txtSearch.InputType = HZH_Controls.TextInputType.NotControl;
......@@ -170,6 +180,11 @@ namespace HZH_Controls.Controls
this.txtSearch.Size = new System.Drawing.Size(437, 42);
this.txtSearch.TabIndex = 0;
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// ucSplitLine_V2
//
this.ucSplitLine_V2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
......@@ -270,5 +285,6 @@ namespace HZH_Controls.Controls
/// The text search
/// </summary>
private UCTextBoxEx txtSearch;
private UCPagerControl m_page;
}
}
......@@ -93,23 +93,20 @@ namespace HZH_Controls.Controls
/// The string last search text
/// </summary>
private string strLastSearchText = string.Empty;
/// <summary>
/// The m page
/// </summary>
UCPagerControl m_page = new UCPagerControl();
/// <summary>
/// Initializes a new instance of the <see cref="UCComboxGridPanel" /> class.
/// </summary>
public UCComboxGridPanel()
{
InitializeComponent();
this.ucDataGridView1.Page = m_page;
this.ucDataGridView1.IsCloseAutoHeight = false;
this.txtSearch.txtInput.TextChanged += txtInput_TextChanged;
this.ucDataGridView1.ItemClick += ucDataGridView1_ItemClick;
m_page.ShowSourceChanged += m_page_ShowSourceChanged;
}
/// <summary>
/// Handles the ItemClick event of the ucDataGridView1 control.
/// </summary>
......@@ -172,7 +169,7 @@ namespace HZH_Controls.Controls
m_page.StartIndex = 0;
if (!string.IsNullOrEmpty(strText))
{
strText = strText.ToLower();
strText = strText.ToLower().Trim();
List<object> lst = m_dataSource.FindAll(p => m_columns.Any(c => (c.Format == null ? (p.GetType().GetProperty(c.DataField).GetValue(p, null).ToStringExt()) : c.Format(p.GetType().GetProperty(c.DataField).GetValue(p, null))).ToLower().Contains(strText)));
m_page.DataSource = lst;
}
......@@ -182,5 +179,10 @@ namespace HZH_Controls.Controls
}
m_page.Reload();
}
void m_page_ShowSourceChanged(object currentSource)
{
this.ucDataGridView1.DataSource = currentSource;
}
}
}
......@@ -53,7 +53,6 @@ namespace HZH_Controls.Controls
this.panHeadLeft = new System.Windows.Forms.Panel();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.panRow = new System.Windows.Forms.Panel();
this.panPage = new System.Windows.Forms.Panel();
this.panHead.SuspendLayout();
this.SuspendLayout();
//
......@@ -105,18 +104,8 @@ namespace HZH_Controls.Controls
this.panRow.Dock = System.Windows.Forms.DockStyle.Fill;
this.panRow.Location = new System.Drawing.Point(0, 40);
this.panRow.Name = "panRow";
this.panRow.Size = new System.Drawing.Size(1061, 481);
this.panRow.Size = new System.Drawing.Size(1061, 525);
this.panRow.TabIndex = 1;
this.panRow.SizeChanged += new System.EventHandler(this.panRow_SizeChanged);
//
// panPage
//
this.panPage.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panPage.Location = new System.Drawing.Point(0, 521);
this.panPage.Name = "panPage";
this.panPage.Size = new System.Drawing.Size(1061, 44);
this.panPage.TabIndex = 0;
this.panPage.Visible = false;
//
// UCDataGridView
//
......@@ -124,11 +113,9 @@ namespace HZH_Controls.Controls
this.AutoScroll = true;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panRow);
this.Controls.Add(this.panPage);
this.Controls.Add(this.panHead);
this.Name = "UCDataGridView";
this.Size = new System.Drawing.Size(1061, 565);
this.Resize += new System.EventHandler(this.UCDataGridView_Resize);
this.panHead.ResumeLayout(false);
this.ResumeLayout(false);
......@@ -153,10 +140,6 @@ namespace HZH_Controls.Controls
/// </summary>
private System.Windows.Forms.Panel panRow;
/// <summary>
/// The pan page
/// </summary>
private System.Windows.Forms.Panel panPage;
/// <summary>
/// The pan head left
/// </summary>
private System.Windows.Forms.Panel panHeadLeft;
......
......@@ -101,7 +101,6 @@ namespace HZH_Controls.Controls
//
this.ucDGVChild.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ucDGVChild.AutoRowsScroll = false;
this.ucDGVChild.BackColor = System.Drawing.Color.White;
this.ucDGVChild.Columns = null;
this.ucDGVChild.DataSource = null;
......@@ -109,12 +108,10 @@ namespace HZH_Controls.Controls
this.ucDGVChild.HeadHeight = 40;
this.ucDGVChild.HeadPadingLeft = 0;
this.ucDGVChild.HeadTextColor = System.Drawing.Color.Black;
this.ucDGVChild.IsCloseAutoHeight = false;
this.ucDGVChild.IsShowCheckBox = false;
this.ucDGVChild.IsShowHead = false;
this.ucDGVChild.Location = new System.Drawing.Point(25, 0);
this.ucDGVChild.Name = "ucDGVChild";
this.ucDGVChild.Page = null;
this.ucDGVChild.RowHeight = 40;
this.ucDGVChild.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
this.ucDGVChild.Size = new System.Drawing.Size(636, 100);
......
......@@ -137,7 +137,6 @@ namespace HZH_Controls.Controls
{
InitializeComponent();
this.ucDGVChild.RowType = this.GetType();
this.ucDGVChild.IsCloseAutoHeight = true;
this.SizeChanged += UCDataGridViewTreeRow_SizeChanged;
this.ucDGVChild.ItemClick += (a, b) =>
{
......@@ -160,11 +159,14 @@ namespace HZH_Controls.Controls
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
void UCDataGridViewTreeRow_SizeChanged(object sender, EventArgs e)
{
if (this.Parent.Parent.Parent != null && this.Parent.Parent.Parent.Name == "panChildGrid" && this.panLeft.Tag.ToInt() == 1)
if (this.Parent != null)
{
int intHeight = this.Parent.Parent.Controls[0].Controls.ToArray().Sum(p => p.Height);
if (this.Parent.Parent.Parent.Height != intHeight)
this.Parent.Parent.Parent.Height = intHeight;
if (this.Parent.Parent.Parent != null && this.Parent.Parent.Parent.Name == "panChildGrid" && this.panLeft.Tag.ToInt() == 1)
{
int intHeight = this.Parent.Parent.Controls[0].Controls.ToArray().Sum(p => p.Height);
if (this.Parent.Parent.Parent.Height != intHeight)
this.Parent.Parent.Parent.Height = intHeight;
}
}
}
......@@ -307,14 +309,17 @@ namespace HZH_Controls.Controls
box.CheckedChangeEvent += (a, b) =>
{
IsChecked = box.Checked;
this.ucDGVChild.Rows.ForEach(p => p.IsChecked = box.Checked);
if (CheckBoxChangeEvent != null)
if (this.ucDGVChild.Rows != null)
{
CheckBoxChangeEvent(a, new DataGridViewEventArgs()
this.ucDGVChild.Rows.ForEach(p => p.IsChecked = box.Checked);
if (CheckBoxChangeEvent != null)
{
CellControl = box,
CellIndex = 0
});
CheckBoxChangeEvent(a, new DataGridViewEventArgs()
{
CellControl = box,
CellIndex = 0
});
}
}
};
c = box;
......
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-09-2019
//
// ***********************************************************************
// <copyright file="IPageControl.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HZH_Controls.Controls
{
/// <summary>
/// Interface IPageControl
/// </summary>
public interface IPageControl
{
/// <summary>
/// 数据源改变时发生
/// </summary>
event PageControlEventHandler ShowSourceChanged;
/// <summary>
/// 数据源
/// </summary>
/// <value>The data source.</value>
List<object> DataSource { get; set; }
/// <summary>
/// 显示数量
/// </summary>
/// <value>The size of the page.</value>
int PageSize { get; set; }
/// <summary>
/// 开始下标
/// </summary>
/// <value>The start index.</value>
int StartIndex { get; set; }
/// <summary>
/// 第一页
/// </summary>
void FirstPage();
/// <summary>
/// 前一页
/// </summary>
void PreviousPage();
/// <summary>
/// 下一页
/// </summary>
void NextPage();
/// <summary>
/// 最后一页
/// </summary>
void EndPage();
/// <summary>
/// 重新加载
/// </summary>
void Reload();
/// <summary>
/// 获取当前页数据
/// </summary>
/// <returns>List&lt;System.Object&gt;.</returns>
List<object> GetCurrentSource();
/// <summary>
/// 总页数
/// </summary>
/// <value>The page count.</value>
int PageCount { get; set; }
/// <summary>
/// 当前页
/// </summary>
/// <value>The index of the page.</value>
int PageIndex { get; set; }
}
}
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-09-2019
//
// ***********************************************************************
// <copyright file="IPageControl.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HZH_Controls.Controls
{
/// <summary>
/// Interface IPageControl
/// </summary>
public interface IPageControl
{
/// <summary>
/// 数据源改变时发生
/// </summary>
event PageControlEventHandler ShowSourceChanged;
/// <summary>
/// 数据源
/// </summary>
/// <value>The data source.</value>
List<object> DataSource { get; set; }
/// <summary>
/// 显示数量
/// </summary>
/// <value>The size of the page.</value>
int PageSize { get; set; }
/// <summary>
/// 开始下标
/// </summary>
/// <value>The start index.</value>
int StartIndex { get; set; }
/// <summary>
/// 第一页
/// </summary>
void FirstPage();
/// <summary>
/// 前一页
/// </summary>
void PreviousPage();
/// <summary>
/// 下一页
/// </summary>
void NextPage();
/// <summary>
/// 最后一页
/// </summary>
void EndPage();
/// <summary>
/// 重新加载
/// </summary>
void Reload();
/// <summary>
/// 获取当前页数据
/// </summary>
/// <returns>List&lt;System.Object&gt;.</returns>
List<object> GetCurrentSource();
/// <summary>
/// 总页数
/// </summary>
/// <value>The page count.</value>
int PageCount { get; set; }
/// <summary>
/// 当前页
/// </summary>
/// <value>The index of the page.</value>
int PageIndex { get; set; }
PageModel PageModel { get; set; }
}
}
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-09-2019
//
// ***********************************************************************
// <copyright file="PageControlEventHandler.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace HZH_Controls.Controls
{
/// <summary>
/// Delegate PageControlEventHandler
/// </summary>
/// <param name="currentSource">The current source.</param>
[Serializable]
[ComVisible(true)]
public delegate void PageControlEventHandler(object currentSource);
}
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-09-2019
//
// ***********************************************************************
// <copyright file="PageControlEventHandler.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace HZH_Controls.Controls
{
/// <summary>
/// Delegate PageControlEventHandler
/// </summary>
/// <param name="currentSource">The current source.</param>
[Serializable]
[ComVisible(true)]
public delegate void PageControlEventHandler(object currentSource);
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HZH_Controls.Controls
{
/// <summary>
/// 翻页控件类型
/// </summary>
public enum PageModel
{
/// <summary>
/// 数据模式
/// </summary>
Soure,
/// <summary>
/// 总页数模式
/// </summary>
PageCount
}
}
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-09-2019
//
// ***********************************************************************
// <copyright file="UCPagerControl.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCPagerControl.
/// Implements the <see cref="HZH_Controls.Controls.UCPagerControlBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Controls.UCPagerControlBase" />
[ToolboxItem(true)]
public partial class UCPagerControl : UCPagerControlBase
{
/// <summary>
/// Initializes a new instance of the <see cref="UCPagerControl" /> class.
/// </summary>
public UCPagerControl()
{
InitializeComponent();
}
/// <summary>
/// Handles the MouseDown event of the panel1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
PreviousPage();
}
/// <summary>
/// Handles the MouseDown event of the panel2 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panel2_MouseDown(object sender, MouseEventArgs e)
{
NextPage();
}
/// <summary>
/// Handles the MouseDown event of the panel3 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panel3_MouseDown(object sender, MouseEventArgs e)
{
FirstPage();
}
/// <summary>
/// Handles the MouseDown event of the panel4 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panel4_MouseDown(object sender, MouseEventArgs e)
{
EndPage();
}
/// <summary>
/// Shows the BTN.
/// </summary>
/// <param name="blnLeftBtn">if set to <c>true</c> [BLN left BTN].</param>
/// <param name="blnRightBtn">if set to <c>true</c> [BLN right BTN].</param>
protected override void ShowBtn(bool blnLeftBtn, bool blnRightBtn)
{
panel1.Visible = panel3.Visible = blnLeftBtn;
panel2.Visible = panel4.Visible = blnRightBtn;
}
}
}
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-09-2019
//
// ***********************************************************************
// <copyright file="UCPagerControl.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCPagerControl.
/// Implements the <see cref="HZH_Controls.Controls.UCPagerControlBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Controls.UCPagerControlBase" />
[ToolboxItem(true)]
public partial class UCPagerControl : UCPagerControlBase
{
public override int PageCount
{
get
{
return base.PageCount;
}
set
{
base.PageCount = value;
if (PageCount <= 1)
{
ShowBtn(false, false);
}
else
{
ShowBtn(false, PageCount > 1);
}
}
}
public override int PageIndex
{
get
{
return base.PageIndex;
}
set
{
base.PageIndex = value;
if (PageCount <= 1)
{
ShowBtn(false, false);
}
else
{
ShowBtn(false, PageCount > 1);
}
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UCPagerControl" /> class.
/// </summary>
public UCPagerControl()
{
InitializeComponent();
}
/// <summary>
/// Handles the MouseDown event of the panel1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
PreviousPage();
}
/// <summary>
/// Handles the MouseDown event of the panel2 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panel2_MouseDown(object sender, MouseEventArgs e)
{
NextPage();
}
/// <summary>
/// Handles the MouseDown event of the panel3 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panel3_MouseDown(object sender, MouseEventArgs e)
{
FirstPage();
}
/// <summary>
/// Handles the MouseDown event of the panel4 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panel4_MouseDown(object sender, MouseEventArgs e)
{
EndPage();
}
/// <summary>
/// Shows the BTN.
/// </summary>
/// <param name="blnLeftBtn">if set to <c>true</c> [BLN left BTN].</param>
/// <param name="blnRightBtn">if set to <c>true</c> [BLN right BTN].</param>
protected override void ShowBtn(bool blnLeftBtn, bool blnRightBtn)
{
panel1.Visible = panel3.Visible = blnLeftBtn;
panel2.Visible = panel4.Visible = blnRightBtn;
}
}
}
......@@ -105,12 +105,48 @@ namespace HZH_Controls.Controls
set
{
base.PageSize = value;
ResetPageCount();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
if (PageModel == HZH_Controls.Controls.PageModel.Soure)
{
ShowSourceChanged(s);
ResetPageCount();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
else
{
if (ShowSourceChanged != null)
{
ShowSourceChanged(this);
}
}
}
}
public override int PageCount
{
get
{
return base.PageCount;
}
set
{
base.PageCount = value;
ReloadPage();
}
}
public override int PageIndex
{
get
{
return base.PageIndex;
}
set
{
base.PageIndex = value;
ReloadPage();
}
}
......@@ -122,12 +158,22 @@ namespace HZH_Controls.Controls
if (PageIndex == 1)
return;
PageIndex = 1;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
if (PageModel == HZH_Controls.Controls.PageModel.Soure)
{
ShowSourceChanged(s);
StartIndex = (PageIndex - 1) * PageSize;
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
else
{
if (ShowSourceChanged != null)
{
ShowSourceChanged(this);
}
}
}
......@@ -141,13 +187,22 @@ namespace HZH_Controls.Controls
return;
}
PageIndex--;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
if (PageModel == HZH_Controls.Controls.PageModel.Soure)
{
StartIndex = (PageIndex - 1) * PageSize;
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
else
{
ShowSourceChanged(s);
if (ShowSourceChanged != null)
{
ShowSourceChanged(this);
}
}
}
......@@ -161,12 +216,22 @@ namespace HZH_Controls.Controls
return;
}
PageIndex++;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
if (PageModel == HZH_Controls.Controls.PageModel.Soure)
{
ShowSourceChanged(s);
StartIndex = (PageIndex - 1) * PageSize;
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
else
{
if (ShowSourceChanged != null)
{
ShowSourceChanged(this);
}
}
}
......@@ -178,12 +243,22 @@ namespace HZH_Controls.Controls
if (PageIndex == PageCount)
return;
PageIndex = PageCount;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
if (PageModel == HZH_Controls.Controls.PageModel.Soure)
{
StartIndex = (PageIndex - 1) * PageSize;
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
else
{
ShowSourceChanged(s);
if (ShowSourceChanged != null)
{
ShowSourceChanged(this);
}
}
}
......@@ -318,11 +393,21 @@ namespace HZH_Controls.Controls
PageIndex = (sender as UCBtnExt).BtnText.ToInt();
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (PageModel == HZH_Controls.Controls.PageModel.Soure)
{
var s = GetCurrentSource();
if (ShowSourceChanged != null)
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
else
{
ShowSourceChanged(s);
if (ShowSourceChanged != null)
{
ShowSourceChanged(this);
}
}
}
......@@ -389,10 +474,20 @@ namespace HZH_Controls.Controls
PageIndex = txtPage.InputText.ToInt();
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
if (PageModel == HZH_Controls.Controls.PageModel.Soure)
{
ShowSourceChanged(s);
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
else
{
if (ShowSourceChanged != null)
{
ShowSourceChanged(this);
}
}
}
}
......
......@@ -91,7 +91,7 @@
//
// dgvRight
//
this.dgvRight.AutoRowsScroll = true;
this.dgvRight.BackColor = System.Drawing.Color.White;
this.dgvRight.Columns = null;
this.dgvRight.DataSource = null;
......@@ -100,12 +100,11 @@
this.dgvRight.HeadHeight = 40;
this.dgvRight.HeadPadingLeft = 0;
this.dgvRight.HeadTextColor = System.Drawing.Color.Black;
this.dgvRight.IsCloseAutoHeight = false;
this.dgvRight.IsShowCheckBox = true;
this.dgvRight.IsShowHead = true;
this.dgvRight.Location = new System.Drawing.Point(1, 1);
this.dgvRight.Name = "dgvRight";
this.dgvRight.Page = null;
this.dgvRight.Name = "dgvRight";
this.dgvRight.RowHeight = 40;
this.dgvRight.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
this.dgvRight.Size = new System.Drawing.Size(194, 395);
......@@ -196,7 +195,6 @@
//
// dgvLeft
//
this.dgvLeft.AutoRowsScroll = true;
this.dgvLeft.BackColor = System.Drawing.Color.White;
this.dgvLeft.Columns = null;
this.dgvLeft.DataSource = null;
......@@ -205,12 +203,10 @@
this.dgvLeft.HeadHeight = 40;
this.dgvLeft.HeadPadingLeft = 0;
this.dgvLeft.HeadTextColor = System.Drawing.Color.Black;
this.dgvLeft.IsCloseAutoHeight = false;
this.dgvLeft.IsShowCheckBox = true;
this.dgvLeft.IsShowHead = true;
this.dgvLeft.Location = new System.Drawing.Point(1, 1);
this.dgvLeft.Name = "dgvLeft";
this.dgvLeft.Page = null;
this.dgvLeft.RowHeight = 40;
this.dgvLeft.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
this.dgvLeft.Size = new System.Drawing.Size(193, 395);
......
......@@ -122,8 +122,6 @@ namespace HZH_Controls.Controls
public UCTransfer()
{
InitializeComponent();
dgvLeft.IsCloseAutoHeight = true;
dgvRight.IsCloseAutoHeight = true;
LeftColumns = new DataGridViewColumnEntity[0];
RightColumns = new DataGridViewColumnEntity[0];
LeftDataSource = new object[0];
......
......@@ -96,6 +96,7 @@
</Compile>
<Compile Include="Controls\Navigation\CrumbNavigationClickEventArgs.cs" />
<Compile Include="Controls\Navigation\CrumbNavigationItem.cs" />
<Compile Include="Controls\Page\PageModel.cs" />
<Compile Include="Controls\Panel\UCPanelQuote.cs">
<SubType>Component</SubType>
</Compile>
......@@ -258,8 +259,8 @@
<DependentUpon>UCLEDTime.cs</DependentUpon>
</Compile>
<Compile Include="Controls\List\IListViewItem.cs" />
<Compile Include="Controls\List\IPageControl.cs" />
<Compile Include="Controls\List\PageControlEventHandler.cs" />
<Compile Include="Controls\Page\IPageControl.cs" />
<Compile Include="Controls\Page\PageControlEventHandler.cs" />
<Compile Include="Controls\List\UCListView.cs">
<SubType>UserControl</SubType>
</Compile>
......@@ -272,16 +273,16 @@
<Compile Include="Controls\List\UCListViewItem.Designer.cs">
<DependentUpon>UCListViewItem.cs</DependentUpon>
</Compile>
<Compile Include="Controls\List\UCPagerControl.cs">
<Compile Include="Controls\Page\UCPagerControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\List\UCPagerControl.Designer.cs">
<Compile Include="Controls\Page\UCPagerControl.Designer.cs">
<DependentUpon>UCPagerControl.cs</DependentUpon>
</Compile>
<Compile Include="Controls\List\UCPagerControl2.cs">
<Compile Include="Controls\Page\UCPagerControl2.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\List\UCPagerControl2.Designer.cs">
<Compile Include="Controls\Page\UCPagerControl2.Designer.cs">
<DependentUpon>UCPagerControl2.cs</DependentUpon>
</Compile>
<Compile Include="Controls\Menu\IMenuItem.cs" />
......@@ -482,7 +483,7 @@
<Compile Include="Controls\List\UCListItemExt.Designer.cs">
<DependentUpon>UCListItemExt.cs</DependentUpon>
</Compile>
<Compile Include="Controls\List\UCPagerControlBase.cs">
<Compile Include="Controls\Page\UCPagerControlBase.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\Process\UCProcessExt.cs">
......@@ -705,13 +706,13 @@
<EmbeddedResource Include="Controls\List\UCListViewItem.resx">
<DependentUpon>UCListViewItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\List\UCPagerControl.resx">
<EmbeddedResource Include="Controls\Page\UCPagerControl.resx">
<DependentUpon>UCPagerControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\List\UCPagerControl2.resx">
<EmbeddedResource Include="Controls\Page\UCPagerControl2.resx">
<DependentUpon>UCPagerControl2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\List\UCPagerControlBase.resx">
<EmbeddedResource Include="Controls\Page\UCPagerControlBase.resx">
<DependentUpon>UCPagerControlBase.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\Menu\UCMenu.resx">
......
......@@ -33,7 +33,6 @@
//
// ucDataGridView1
//
this.ucDataGridView1.AutoRowsScroll = false;
this.ucDataGridView1.BackColor = System.Drawing.Color.White;
this.ucDataGridView1.Columns = null;
this.ucDataGridView1.DataSource = null;
......@@ -42,12 +41,10 @@
this.ucDataGridView1.HeadHeight = 40;
this.ucDataGridView1.HeadPadingLeft = 0;
this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black;
this.ucDataGridView1.IsCloseAutoHeight = false;
this.ucDataGridView1.IsShowCheckBox = false;
this.ucDataGridView1.IsShowHead = true;
this.ucDataGridView1.Location = new System.Drawing.Point(0, 0);
this.ucDataGridView1.Name = "ucDataGridView1";
this.ucDataGridView1.Page = null;
this.ucDataGridView1.RowHeight = 41;
this.ucDataGridView1.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
this.ucDataGridView1.Size = new System.Drawing.Size(739, 599);
......
......@@ -16,18 +16,8 @@ namespace Test.UC
public UCTestGridTable()
{
InitializeComponent();
ucDataGridView1.SizeChanged += ucDataGridView1_SizeChanged;
ucDataGridView1.IsCloseAutoHeight = false;
}
void ucDataGridView1_SizeChanged(object sender, EventArgs e)
{
if (this.ucDataGridView1.Page != null)
{
this.ucDataGridView1.Page.PageSize = this.ucDataGridView1.ShowCount;
this.ucDataGridView1.DataSource= this.ucDataGridView1.Page.GetCurrentSource();
}
}
private void UCTestGridTable_Load(object sender, EventArgs e)
{
......@@ -51,12 +41,8 @@ namespace Test.UC
Sex = i % 2
};
lstSource.Add(model);
}
var page = new UCPagerControl2();
page.DataSource = lstSource;
this.ucDataGridView1.Page = page;
this.ucDataGridView1.First();
}
this.ucDataGridView1.DataSource = lstSource;
}
}
......
......@@ -32,16 +32,23 @@
this.ucPagerControl21 = new HZH_Controls.Controls.UCPagerControl2();
this.ucPagerControl1 = new HZH_Controls.Controls.UCPagerControl();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.ucPagerControl22 = new HZH_Controls.Controls.UCPagerControl2();
this.ucPagerControl2 = new HZH_Controls.Controls.UCPagerControl();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// ucPagerControl21
//
this.ucPagerControl21.BackColor = System.Drawing.Color.White;
this.ucPagerControl21.DataSource = ((System.Collections.Generic.List<object>)(resources.GetObject("ucPagerControl21.DataSource")));
this.ucPagerControl21.Location = new System.Drawing.Point(31, 19);
this.ucPagerControl21.Location = new System.Drawing.Point(21, 35);
this.ucPagerControl21.Name = "ucPagerControl21";
this.ucPagerControl21.PageCount = 0;
this.ucPagerControl21.PageIndex = 1;
this.ucPagerControl21.PageModel = HZH_Controls.Controls.PageModel.Soure;
this.ucPagerControl21.PageSize = 0;
this.ucPagerControl21.Size = new System.Drawing.Size(709, 41);
this.ucPagerControl21.StartIndex = 0;
......@@ -50,10 +57,11 @@
// ucPagerControl1
//
this.ucPagerControl1.DataSource = null;
this.ucPagerControl1.Location = new System.Drawing.Point(60, 77);
this.ucPagerControl1.Location = new System.Drawing.Point(21, 82);
this.ucPagerControl1.Name = "ucPagerControl1";
this.ucPagerControl1.PageCount = 0;
this.ucPagerControl1.PageIndex = 1;
this.ucPagerControl1.PageModel = HZH_Controls.Controls.PageModel.Soure;
this.ucPagerControl1.PageSize = 1;
this.ucPagerControl1.Size = new System.Drawing.Size(304, 58);
this.ucPagerControl1.StartIndex = 0;
......@@ -62,24 +70,75 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(58, 182);
this.label1.Location = new System.Drawing.Point(477, 128);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(197, 12);
this.label1.TabIndex = 7;
this.label1.Text = "模拟1000条数据,每页10条展示分页";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.ucPagerControl21);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.ucPagerControl1);
this.groupBox1.Location = new System.Drawing.Point(15, 13);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(753, 176);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "数据模式(PageModel=Source)";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.ucPagerControl22);
this.groupBox2.Controls.Add(this.ucPagerControl2);
this.groupBox2.Location = new System.Drawing.Point(15, 216);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(753, 176);
this.groupBox2.TabIndex = 8;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "页数模式(PageModel=PageCount)";
//
// ucPagerControl22
//
this.ucPagerControl22.BackColor = System.Drawing.Color.White;
this.ucPagerControl22.DataSource = ((System.Collections.Generic.List<object>)(resources.GetObject("ucPagerControl22.DataSource")));
this.ucPagerControl22.Location = new System.Drawing.Point(21, 35);
this.ucPagerControl22.Name = "ucPagerControl22";
this.ucPagerControl22.PageCount = 0;
this.ucPagerControl22.PageIndex = 1;
this.ucPagerControl22.PageModel = HZH_Controls.Controls.PageModel.PageCount;
this.ucPagerControl22.PageSize = 0;
this.ucPagerControl22.Size = new System.Drawing.Size(709, 41);
this.ucPagerControl22.StartIndex = 0;
this.ucPagerControl22.TabIndex = 5;
//
// ucPagerControl2
//
this.ucPagerControl2.DataSource = null;
this.ucPagerControl2.Location = new System.Drawing.Point(21, 82);
this.ucPagerControl2.Name = "ucPagerControl2";
this.ucPagerControl2.PageCount = 0;
this.ucPagerControl2.PageIndex = 1;
this.ucPagerControl2.PageModel = HZH_Controls.Controls.PageModel.PageCount;
this.ucPagerControl2.PageSize = 1;
this.ucPagerControl2.Size = new System.Drawing.Size(304, 58);
this.ucPagerControl2.StartIndex = 0;
this.ucPagerControl2.TabIndex = 6;
//
// UCTestPage
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.label1);
this.Controls.Add(this.ucPagerControl1);
this.Controls.Add(this.ucPagerControl21);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "UCTestPage";
this.Size = new System.Drawing.Size(782, 304);
this.Size = new System.Drawing.Size(782, 567);
this.Load += new System.EventHandler(this.UCTestPage_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
......@@ -88,5 +147,9 @@
private HZH_Controls.Controls.UCPagerControl2 ucPagerControl21;
private HZH_Controls.Controls.UCPagerControl ucPagerControl1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private HZH_Controls.Controls.UCPagerControl2 ucPagerControl22;
private HZH_Controls.Controls.UCPagerControl ucPagerControl2;
}
}
......@@ -32,6 +32,12 @@ namespace Test.UC
ucPagerControl1.DataSource = lstPage2;
this.ucPagerControl1.FirstPage();
ucPagerControl22.PageCount = 10;
ucPagerControl22.PageIndex = 1;
ucPagerControl2.PageCount = 10;
ucPagerControl2.PageIndex = 1;
}
}
}
......@@ -126,4 +126,13 @@
ZW1zBV9zaXplCF92ZXJzaW9uBQAACAgCAAAACQMAAAAAAAAAAAAAABADAAAAAAAAAAs=
</value>
</data>
<data name="ucPagerControl22.DataSource" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLk9iamVjdAMAAAAGX2l0
ZW1zBV9zaXplCF92ZXJzaW9uBQAACAgCAAAACQMAAAAAAAAAAAAAABADAAAAAAAAAAs=
</value>
</data>
</root>
\ No newline at end of file
......@@ -33,7 +33,6 @@
//
// ucDataGridView1
//
this.ucDataGridView1.AutoRowsScroll = true;
this.ucDataGridView1.BackColor = System.Drawing.Color.White;
this.ucDataGridView1.Columns = null;
this.ucDataGridView1.DataSource = null;
......@@ -42,12 +41,10 @@
this.ucDataGridView1.HeadHeight = 40;
this.ucDataGridView1.HeadPadingLeft = 24;
this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black;
this.ucDataGridView1.IsCloseAutoHeight = false;
this.ucDataGridView1.IsShowCheckBox = false;
this.ucDataGridView1.IsShowHead = true;
this.ucDataGridView1.Location = new System.Drawing.Point(0, 0);
this.ucDataGridView1.Name = "ucDataGridView1";
this.ucDataGridView1.Page = null;
this.ucDataGridView1.RowHeight = 41;
this.ucDataGridView1.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
this.ucDataGridView1.Size = new System.Drawing.Size(825, 674);
......
......@@ -15,19 +15,9 @@ namespace Test.UC
{
public UCTestTreeGridTable()
{
InitializeComponent();
ucDataGridView1.SizeChanged += ucDataGridView1_SizeChanged;
InitializeComponent();
}
void ucDataGridView1_SizeChanged(object sender, EventArgs e)
{
if (this.ucDataGridView1.Page != null)
{
this.ucDataGridView1.ResetShowCount();
this.ucDataGridView1.Page.PageSize = this.ucDataGridView1.ShowCount;
this.ucDataGridView1.DataSource = this.ucDataGridView1.Page.GetCurrentSource();
}
}
private void UCTestTreeGridTable_Load(object sender, EventArgs e)
{
......@@ -55,10 +45,7 @@ namespace Test.UC
AddChilds(model, 5);
}
var page = new UCPagerControl2();
page.DataSource = lstSource;
this.ucDataGridView1.Page = page;
this.ucDataGridView1.First();
this.ucDataGridView1.DataSource = lstSource;
}
private void AddChilds(TestGridModel tm, int intCount)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!