Commit ba589629 HZH

datagridview绑定分页控件

1 个父辈 5f164a46
...@@ -335,47 +335,55 @@ namespace HZH_Controls.Controls ...@@ -335,47 +335,55 @@ namespace HZH_Controls.Controls
private void click_MouseDown(object sender, MouseEventArgs e) private void click_MouseDown(object sender, MouseEventArgs e)
{ {
if (this.Source != null && this.Source.Count > 0) if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
{ {
int intRow = 0;
int intCom = 1; if (this.Source != null && this.Source.Count > 0)
var p = this.PointToScreen(this.Location);
while (true)
{ {
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height; int intRow = 0;
if ((p.Y + this.Height + this.Source.Count / intCom * 50 < intScreenHeight || p.Y - this.Source.Count / intCom * 50 > 0) int intCom = 1;
&& (_dropPanelHeight <= 0 ? true : (this.Source.Count / intCom * 50 <= _dropPanelHeight))) var p = this.PointToScreen(this.Location);
while (true)
{ {
intRow = this.Source.Count / intCom + (this.Source.Count % intCom != 0 ? 1 : 0); int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
break; if ((p.Y + this.Height + this.Source.Count / intCom * 50 < intScreenHeight || p.Y - this.Source.Count / intCom * 50 > 0)
&& (_dropPanelHeight <= 0 ? true : (this.Source.Count / intCom * 50 <= _dropPanelHeight)))
{
intRow = this.Source.Count / intCom + (this.Source.Count % intCom != 0 ? 1 : 0);
break;
}
intCom++;
} }
intCom++; UCTimePanel ucTime = new UCTimePanel();
} ucTime.IsShowBorder = true;
UCTimePanel ucTime = new UCTimePanel(); int intWidth = this.Width / intCom;
ucTime.IsShowBorder = true; if (intWidth < _ItemWidth)
int intWidth = this.Width / intCom; intWidth = _ItemWidth;
if (intWidth < _ItemWidth) Size size = new Size(intCom * intWidth, intRow * 50);
intWidth = _ItemWidth; ucTime.Size = size;
Size size= new Size(intCom * intWidth, intRow * 50); ucTime.FirstEvent = true;
ucTime.Size =size; ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
ucTime.FirstEvent = true; ucTime.Row = intRow;
ucTime.SelectSourceEvent += ucTime_SelectSourceEvent; ucTime.Column = intCom;
ucTime.Row = intRow; List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>();
ucTime.Column = intCom; foreach (var item in this.Source)
List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>(); {
foreach (var item in this.Source) lst.Add(new KeyValuePair<string, string>(item.Key, item.Value));
{ }
lst.Add(new KeyValuePair<string, string>(item.Key, item.Value)); ucTime.Source = lst;
}
ucTime.Source = lst; ucTime.SetSelect(_selectedValue);
ucTime.SetSelect(_selectedValue); _frmAnchor = new Forms.FrmAnchor(this, ucTime);
_frmAnchor.Load += (a, b) => { (a as Form).Size = size; };
_frmAnchor = new Forms.FrmAnchor(this, ucTime); _frmAnchor.Show(this.FindForm());
_frmAnchor.Load += (a, b) => { (a as Form).Size = size; };
_frmAnchor.Show(this.FindForm());
}
}
else
{
_frmAnchor.Close();
} }
} }
......
...@@ -6,7 +6,7 @@ using System.Windows.Forms; ...@@ -6,7 +6,7 @@ using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
public class DataGridViewCellEventArgs : EventArgs public class DataGridViewEventArgs : EventArgs
{ {
public Control CellControl { get; set; } public Control CellControl { get; set; }
public int CellIndex { get; set; } public int CellIndex { get; set; }
......
...@@ -8,5 +8,5 @@ namespace HZH_Controls.Controls ...@@ -8,5 +8,5 @@ namespace HZH_Controls.Controls
{ {
[Serializable] [Serializable]
[ComVisible(true)] [ComVisible(true)]
public delegate void DataGridViewCellEventHandler(object sender, DataGridViewCellEventArgs e); public delegate void DataGridViewEventHandler(object sender, DataGridViewEventArgs e);
} }
...@@ -11,15 +11,15 @@ namespace HZH_Controls.Controls ...@@ -11,15 +11,15 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// CheckBox选中事件 /// CheckBox选中事件
/// </summary> /// </summary>
event DataGridViewCellEventHandler CheckBoxChangeEvent; event DataGridViewEventHandler CheckBoxChangeEvent;
/// <summary> /// <summary>
/// 点击单元格事件 /// 点击单元格事件
/// </summary> /// </summary>
event DataGridViewCellEventHandler CellClick; event DataGridViewEventHandler CellClick;
/// <summary> /// <summary>
/// 数据源改变事件 /// 数据源改变事件
/// </summary> /// </summary>
event DataGridViewCellEventHandler SourceChanged; event DataGridViewEventHandler SourceChanged;
/// <summary> /// <summary>
/// 列参数,用于创建列数和宽度 /// 列参数,用于创建列数和宽度
/// </summary> /// </summary>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
this.panColumns = new System.Windows.Forms.TableLayoutPanel(); this.panColumns = new System.Windows.Forms.TableLayoutPanel();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H(); this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.panRow = new System.Windows.Forms.Panel(); this.panRow = new System.Windows.Forms.Panel();
this.panPage = new System.Windows.Forms.Panel();
this.panHead.SuspendLayout(); this.panHead.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -74,14 +75,24 @@ ...@@ -74,14 +75,24 @@
this.panRow.Dock = System.Windows.Forms.DockStyle.Fill; this.panRow.Dock = System.Windows.Forms.DockStyle.Fill;
this.panRow.Location = new System.Drawing.Point(0, 40); this.panRow.Location = new System.Drawing.Point(0, 40);
this.panRow.Name = "panRow"; this.panRow.Name = "panRow";
this.panRow.Size = new System.Drawing.Size(1061, 525); this.panRow.Size = new System.Drawing.Size(1061, 475);
this.panRow.TabIndex = 1; this.panRow.TabIndex = 1;
// //
// panPage
//
this.panPage.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panPage.Location = new System.Drawing.Point(0, 515);
this.panPage.Name = "panPage";
this.panPage.Size = new System.Drawing.Size(1061, 50);
this.panPage.TabIndex = 0;
this.panPage.Visible = false;
//
// UCDataGridView // UCDataGridView
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panRow); this.Controls.Add(this.panRow);
this.Controls.Add(this.panPage);
this.Controls.Add(this.panHead); this.Controls.Add(this.panHead);
this.Name = "UCDataGridView"; this.Name = "UCDataGridView";
this.Size = new System.Drawing.Size(1061, 565); this.Size = new System.Drawing.Size(1061, 565);
...@@ -97,6 +108,7 @@ ...@@ -97,6 +108,7 @@
private System.Windows.Forms.TableLayoutPanel panColumns; private System.Windows.Forms.TableLayoutPanel panColumns;
private UCSplitLine_H ucSplitLine_H1; private UCSplitLine_H ucSplitLine_H1;
private System.Windows.Forms.Panel panRow; private System.Windows.Forms.Panel panRow;
private System.Windows.Forms.Panel panPage;
} }
} }
...@@ -17,6 +17,7 @@ namespace HZH_Controls.Controls ...@@ -17,6 +17,7 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 标题字体 /// 标题字体
/// </summary> /// </summary>
[Description("标题字体"), Category("自定义")]
public Font HeadFont public Font HeadFont
{ {
get { return m_headFont; } get { return m_headFont; }
...@@ -26,6 +27,7 @@ namespace HZH_Controls.Controls ...@@ -26,6 +27,7 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 标题字体颜色 /// 标题字体颜色
/// </summary> /// </summary>
[Description("标题文字颜色"), Category("自定义")]
public Color HeadTextColor public Color HeadTextColor
{ {
get { return m_headTextColor; } get { return m_headTextColor; }
...@@ -36,6 +38,7 @@ namespace HZH_Controls.Controls ...@@ -36,6 +38,7 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 是否显示标题 /// 是否显示标题
/// </summary> /// </summary>
[Description("是否显示标题"), Category("自定义")]
public bool IsShowHead public bool IsShowHead
{ {
get { return m_isShowHead; } get { return m_isShowHead; }
...@@ -43,12 +46,18 @@ namespace HZH_Controls.Controls ...@@ -43,12 +46,18 @@ namespace HZH_Controls.Controls
{ {
m_isShowHead = value; m_isShowHead = value;
panHead.Visible = value; panHead.Visible = value;
if (m_page != null)
{
ResetShowCount();
m_page.PageSize = m_showCount;
}
} }
} }
private int m_headHeight = 40; private int m_headHeight = 40;
/// <summary> /// <summary>
/// 标题高度 /// 标题高度
/// </summary> /// </summary>
[Description("标题高度"), Category("自定义")]
public int HeadHeight public int HeadHeight
{ {
get { return m_headHeight; } get { return m_headHeight; }
...@@ -63,6 +72,7 @@ namespace HZH_Controls.Controls ...@@ -63,6 +72,7 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 是否显示复选框 /// 是否显示复选框
/// </summary> /// </summary>
[Description("是否显示选择框"), Category("自定义")]
public bool IsShowCheckBox public bool IsShowCheckBox
{ {
get { return m_isShowCheckBox; } get { return m_isShowCheckBox; }
...@@ -80,6 +90,7 @@ namespace HZH_Controls.Controls ...@@ -80,6 +90,7 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 行高 /// 行高
/// </summary> /// </summary>
[Description("数据行高"), Category("自定义")]
public int RowHeight public int RowHeight
{ {
get { return m_rowHeight; } get { return m_rowHeight; }
...@@ -90,15 +101,25 @@ namespace HZH_Controls.Controls ...@@ -90,15 +101,25 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[Description("可显示个数"), Category("自定义")]
public int ShowCount public int ShowCount
{ {
get { return m_showCount; } get { return m_showCount; }
private set
{
m_showCount = value;
if (m_page != null)
{
m_page.PageSize = value;
}
}
} }
private List<DataGridViewColumnEntity> m_columns; private List<DataGridViewColumnEntity> m_columns;
/// <summary> /// <summary>
/// 列 /// 列
/// </summary> /// </summary>
[Description("列"), Category("自定义")]
public List<DataGridViewColumnEntity> Columns public List<DataGridViewColumnEntity> Columns
{ {
get { return m_columns; } get { return m_columns; }
...@@ -109,11 +130,11 @@ namespace HZH_Controls.Controls ...@@ -109,11 +130,11 @@ namespace HZH_Controls.Controls
} }
} }
private object m_dataSource; private object m_dataSource;
/// <summary> /// <summary>
/// 数据源,支持列表或table,如果使用翻页控件,请使用翻页控件的DataSource /// 数据源,支持列表或table,如果使用翻页控件,请使用翻页控件的DataSource
/// </summary> /// </summary>
[Description("数据源,支持列表或table,如果使用翻页控件,请使用翻页控件的DataSource"), Category("自定义")]
public object DataSource public object DataSource
{ {
get { return m_dataSource; } get { return m_dataSource; }
...@@ -137,6 +158,7 @@ namespace HZH_Controls.Controls ...@@ -137,6 +158,7 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 行元素类型,默认UCDataGridViewItem /// 行元素类型,默认UCDataGridViewItem
/// </summary> /// </summary>
[Description("行控件类型,默认UCDataGridViewRow,如果不满足请自定义行控件实现接口IDataGridViewRow"), Category("自定义")]
public Type RowType public Type RowType
{ {
get { return m_rowType; } get { return m_rowType; }
...@@ -151,6 +173,7 @@ namespace HZH_Controls.Controls ...@@ -151,6 +173,7 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 选中的节点 /// 选中的节点
/// </summary> /// </summary>
[Description("选中行"), Category("自定义")]
public IDataGridViewRow SelectRow public IDataGridViewRow SelectRow
{ {
get { return m_selectRow; } get { return m_selectRow; }
...@@ -161,6 +184,7 @@ namespace HZH_Controls.Controls ...@@ -161,6 +184,7 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 选中的行,如果显示CheckBox,则以CheckBox选中为准 /// 选中的行,如果显示CheckBox,则以CheckBox选中为准
/// </summary> /// </summary>
[Description("选中的行,如果显示CheckBox,则以CheckBox选中为准"), Category("自定义")]
public List<IDataGridViewRow> SelectRows public List<IDataGridViewRow> SelectRows
{ {
get get
...@@ -173,14 +197,53 @@ namespace HZH_Controls.Controls ...@@ -173,14 +197,53 @@ namespace HZH_Controls.Controls
return new List<IDataGridViewRow>() { m_selectRow }; return new List<IDataGridViewRow>() { m_selectRow };
} }
} }
private UCPagerControlBase m_page = null;
/// <summary>
/// 翻页控件
/// </summary>
[Description("翻页控件,如果UCPagerControl不满足你的需求,请自定义翻页控件并继承UCPagerControlBase"), Category("自定义")]
public UCPagerControlBase Page
{
get { return m_page; }
set
{
if (!typeof(IPageControl).IsAssignableFrom(value.GetType()) || !value.GetType().IsSubclassOf(typeof(UCPagerControlBase)))
throw new Exception("翻页控件没有继承UCPagerControlBase");
panPage.Visible = value != null;
m_page = value;
if (value != null)
{
m_page.ShowSourceChanged += page_ShowSourceChanged;
m_page.Dock = DockStyle.Fill;
this.panPage.Controls.Clear();
this.panPage.Controls.Add(m_page);
ResetShowCount();
m_page.PageSize = ShowCount;
this.DataSource = m_page.GetCurrentSource();
}
else
{
m_page = null;
}
}
}
void page_ShowSourceChanged(object currentSource)
{
this.DataSource = currentSource;
}
#region 事件 #region 事件
[Description("选中标题选择框事件"), Category("自定义")]
public EventHandler HeadCheckBoxChangeEvent; public EventHandler HeadCheckBoxChangeEvent;
[Description("标题点击事件"), Category("自定义")]
public EventHandler HeadColumnClickEvent; public EventHandler HeadColumnClickEvent;
[Description("项点击事件"), Category("自定义")] [Description("项点击事件"), Category("自定义")]
public event DataGridViewCellEventHandler ItemClick; public event DataGridViewEventHandler ItemClick;
[Description("数据源改变事件"), Category("自定义")] [Description("数据源改变事件"), Category("自定义")]
public event DataGridViewCellEventHandler SourceChanged; public event DataGridViewEventHandler SourceChanged;
#endregion #endregion
#endregion #endregion
...@@ -268,7 +331,7 @@ namespace HZH_Controls.Controls ...@@ -268,7 +331,7 @@ namespace HZH_Controls.Controls
} }
} }
#endregion #endregion
/// <summary> /// <summary>
/// 功能描述:获取显示个数 /// 功能描述:获取显示个数
/// 作  者:HZH /// 作  者:HZH
...@@ -280,14 +343,16 @@ namespace HZH_Controls.Controls ...@@ -280,14 +343,16 @@ namespace HZH_Controls.Controls
{ {
if (DesignMode) if (DesignMode)
{ return; } { return; }
m_showCount = this.Height / (m_rowHeight); ShowCount = this.panRow.Height / (m_rowHeight);
int intCha = this.Height % (m_rowHeight); int intCha = this.panRow.Height % (m_rowHeight);
m_rowHeight += intCha / m_showCount; m_rowHeight += intCha / ShowCount;
} }
#endregion #endregion
#region 公共函数 #region 公共函数
/// <summary>
/// 刷新数据
/// </summary>
public void ReloadSource() public void ReloadSource()
{ {
if (DesignMode) if (DesignMode)
...@@ -366,7 +431,7 @@ namespace HZH_Controls.Controls ...@@ -366,7 +431,7 @@ namespace HZH_Controls.Controls
row.BindingCellData(); row.BindingCellData();
Control rowControl = (row as Control); Control rowControl = (row as Control);
rowControl.Height = m_rowHeight; rowControl.Height = m_rowHeight;
this.panRow.Controls.Add(rowControl); this.panRow.Controls.Add(rowControl);
rowControl.Dock = DockStyle.Top; rowControl.Dock = DockStyle.Top;
...@@ -382,7 +447,7 @@ namespace HZH_Controls.Controls ...@@ -382,7 +447,7 @@ namespace HZH_Controls.Controls
} }
if (lastItem != null && intSourceCount == m_showCount) if (lastItem != null && intSourceCount == m_showCount)
{ {
lastItem.Height = this.Height - (m_showCount - 1) * m_rowHeight; lastItem.Height = this.panRow.Height - (m_showCount - 1) * m_rowHeight;
} }
} }
} }
...@@ -392,8 +457,13 @@ namespace HZH_Controls.Controls ...@@ -392,8 +457,13 @@ namespace HZH_Controls.Controls
} }
} }
/// <summary>
/// 快捷键
/// </summary>
/// <param name="msg"></param>
/// <param name="keyData"></param>
/// <returns></returns>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{ {
if (keyData == Keys.Up) if (keyData == Keys.Up)
...@@ -423,7 +493,7 @@ namespace HZH_Controls.Controls ...@@ -423,7 +493,7 @@ namespace HZH_Controls.Controls
return; return;
Control c = null; Control c = null;
c = (Rows[0] as Control); c = (Rows[0] as Control);
SetSelectRow(c, new DataGridViewCellEventArgs() { RowIndex = 0 }); SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = 0 });
} }
/// <summary> /// <summary>
/// 选中上一个 /// 选中上一个
...@@ -438,7 +508,7 @@ namespace HZH_Controls.Controls ...@@ -438,7 +508,7 @@ namespace HZH_Controls.Controls
if (index - 1 >= 0) if (index - 1 >= 0)
{ {
c = (Rows[index - 1] as Control); c = (Rows[index - 1] as Control);
SetSelectRow(c, new DataGridViewCellEventArgs() { RowIndex = index - 1 }); SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = index - 1 });
} }
} }
/// <summary> /// <summary>
...@@ -454,7 +524,7 @@ namespace HZH_Controls.Controls ...@@ -454,7 +524,7 @@ namespace HZH_Controls.Controls
if (index + 1 < Rows.Count) if (index + 1 < Rows.Count)
{ {
c = (Rows[index + 1] as Control); c = (Rows[index + 1] as Control);
SetSelectRow(c, new DataGridViewCellEventArgs() { RowIndex = index + 1 }); SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = index + 1 });
} }
} }
/// <summary> /// <summary>
...@@ -466,38 +536,56 @@ namespace HZH_Controls.Controls ...@@ -466,38 +536,56 @@ namespace HZH_Controls.Controls
return; return;
Control c = null; Control c = null;
c = (Rows[Rows.Count - 1] as Control); c = (Rows[Rows.Count - 1] as Control);
SetSelectRow(c, new DataGridViewCellEventArgs() { RowIndex = Rows.Count - 1 }); SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = Rows.Count - 1 });
} }
#endregion #endregion
#region 事件 #region 事件
void RowSourceChanged(object sender, DataGridViewCellEventArgs e) void RowSourceChanged(object sender, DataGridViewEventArgs e)
{ {
if (SourceChanged != null) if (SourceChanged != null)
SourceChanged(sender, e); SourceChanged(sender, e);
} }
private void SetSelectRow(Control item, DataGridViewCellEventArgs e) private void SetSelectRow(Control item, DataGridViewEventArgs e)
{ {
if (item == null) try
return;
if (item.Visible == false)
return;
this.FindForm().ActiveControl = this;
this.FindForm().ActiveControl = item;
if (m_selectRow != null)
{ {
if (m_selectRow == item) ControlHelper.FreezeControl(this, true);
if (item == null)
return;
if (item.Visible == false)
return; return;
m_selectRow.SetSelect(false); this.FindForm().ActiveControl = this;
this.FindForm().ActiveControl = item;
if (m_selectRow != null)
{
if (m_selectRow == item)
return;
m_selectRow.SetSelect(false);
}
m_selectRow = item as IDataGridViewRow;
m_selectRow.SetSelect(true);
if (ItemClick != null)
{
ItemClick(item, e);
}
if (this.panRow.Controls.Count > 0)
{
if (item.Location.Y < 0)
{
this.panRow.AutoScrollPosition = new Point(0, Math.Abs(this.panRow.Controls[this.panRow.Controls.Count - 1].Location.Y) + item.Location.Y);
}
else if (item.Location.Y + m_rowHeight > this.panRow.Height)
{
this.panRow.AutoScrollPosition = new Point(0, Math.Abs(this.panRow.AutoScrollPosition.Y) + item.Location.Y - this.panRow.Height + m_rowHeight);
}
}
} }
m_selectRow = item as IDataGridViewRow; finally
m_selectRow.SetSelect(true);
if (ItemClick != null)
{ {
ItemClick(item, e); ControlHelper.FreezeControl(this, false);
} }
this.panRow.AutoScrollPosition = new Point(0, item.Location.Y);
} }
private void UCDataGridView_Resize(object sender, EventArgs e) private void UCDataGridView_Resize(object sender, EventArgs e)
{ {
......
...@@ -9,15 +9,16 @@ using System.Windows.Forms; ...@@ -9,15 +9,16 @@ using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
[ToolboxItem(false)]
public partial class UCDataGridViewRow : UserControl, IDataGridViewRow public partial class UCDataGridViewRow : UserControl, IDataGridViewRow
{ {
#region 属性 #region 属性
public event DataGridViewCellEventHandler CheckBoxChangeEvent; public event DataGridViewEventHandler CheckBoxChangeEvent;
public event DataGridViewCellEventHandler CellClick; public event DataGridViewEventHandler CellClick;
public event DataGridViewCellEventHandler SourceChanged; public event DataGridViewEventHandler SourceChanged;
public List<DataGridViewColumnEntity> Columns public List<DataGridViewColumnEntity> Columns
{ {
...@@ -81,7 +82,7 @@ namespace HZH_Controls.Controls ...@@ -81,7 +82,7 @@ namespace HZH_Controls.Controls
{ {
if (CellClick != null) if (CellClick != null)
{ {
CellClick(sender, new DataGridViewCellEventArgs() CellClick(sender, new DataGridViewEventArgs()
{ {
CellControl = this, CellControl = this,
CellIndex = (sender as Control).Tag.ToInt() CellIndex = (sender as Control).Tag.ToInt()
...@@ -134,7 +135,7 @@ namespace HZH_Controls.Controls ...@@ -134,7 +135,7 @@ namespace HZH_Controls.Controls
IsChecked = box.Checked; IsChecked = box.Checked;
if (CheckBoxChangeEvent != null) if (CheckBoxChangeEvent != null)
{ {
CheckBoxChangeEvent(a, new DataGridViewCellEventArgs() CheckBoxChangeEvent(a, new DataGridViewEventArgs()
{ {
CellControl = box, CellControl = box,
CellIndex = 0 CellIndex = 0
......
...@@ -10,7 +10,7 @@ namespace HZH_Controls.Controls ...@@ -10,7 +10,7 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 数据源改变时发生 /// 数据源改变时发生
/// </summary> /// </summary>
event PageControlEventHandler ShowChanged; event PageControlEventHandler ShowSourceChanged;
/// <summary> /// <summary>
/// 数据源 /// 数据源
/// </summary> /// </summary>
......
namespace HZH_Controls.Controls.List namespace HZH_Controls.Controls
{ {
partial class UCPagerControl partial class UCPagerControl
{ {
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
this.panel4.Name = "panel4"; this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(68, 46); this.panel4.Size = new System.Drawing.Size(68, 46);
this.panel4.TabIndex = 3; this.panel4.TabIndex = 3;
this.panel4.Visible = false;
this.panel4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel4_MouseDown); this.panel4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel4_MouseDown);
// //
// panel3 // panel3
...@@ -75,7 +74,6 @@ ...@@ -75,7 +74,6 @@
this.panel3.Name = "panel3"; this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(68, 46); this.panel3.Size = new System.Drawing.Size(68, 46);
this.panel3.TabIndex = 2; this.panel3.TabIndex = 2;
this.panel3.Visible = false;
this.panel3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel3_MouseDown); this.panel3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel3_MouseDown);
// //
// panel2 // panel2
...@@ -86,7 +84,6 @@ ...@@ -86,7 +84,6 @@
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(68, 46); this.panel2.Size = new System.Drawing.Size(68, 46);
this.panel2.TabIndex = 1; this.panel2.TabIndex = 1;
this.panel2.Visible = false;
this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown); this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown);
// //
// panel1 // panel1
...@@ -97,7 +94,6 @@ ...@@ -97,7 +94,6 @@
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(68, 46); this.panel1.Size = new System.Drawing.Size(68, 46);
this.panel1.TabIndex = 0; this.panel1.TabIndex = 0;
this.panel1.Visible = false;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown);
// //
// UCPagerControl // UCPagerControl
......
...@@ -7,13 +7,14 @@ using System.Linq; ...@@ -7,13 +7,14 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls.List namespace HZH_Controls.Controls
{ {
[ToolboxItem(true)]
public partial class UCPagerControl : UCPagerControlBase public partial class UCPagerControl : UCPagerControlBase
{ {
public UCPagerControl() public UCPagerControl()
{ {
InitializeComponent(); InitializeComponent();
} }
private void panel1_MouseDown(object sender, MouseEventArgs e) private void panel1_MouseDown(object sender, MouseEventArgs e)
......
...@@ -9,6 +9,7 @@ using System.Windows.Forms; ...@@ -9,6 +9,7 @@ using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
[ToolboxItem(false)]
public class UCPagerControlBase : UserControl, IPageControl public class UCPagerControlBase : UserControl, IPageControl
{ {
#region 构造 #region 构造
...@@ -39,9 +40,13 @@ namespace HZH_Controls.Controls ...@@ -39,9 +40,13 @@ namespace HZH_Controls.Controls
private void InitializeComponent() private void InitializeComponent()
{ {
this.SuspendLayout(); this.SuspendLayout();
//
// UCPagerControlBase
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Name = "UCPagerControlBase"; this.Name = "UCPagerControlBase";
this.Size = new System.Drawing.Size(304, 58); this.Size = new System.Drawing.Size(304, 58);
this.Load += new System.EventHandler(this.UCPagerControlBase_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
...@@ -52,13 +57,14 @@ namespace HZH_Controls.Controls ...@@ -52,13 +57,14 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 关联的数据源 /// 关联的数据源
/// </summary> /// </summary>
public List<object> DataSource { get; set; } public virtual List<object> DataSource { get; set; }
public event PageControlEventHandler ShowChanged; public event PageControlEventHandler ShowSourceChanged;
private int m_pageSize = 1; private int m_pageSize = 1;
/// <summary> /// <summary>
/// 每页显示数量 /// 每页显示数量
/// </summary> /// </summary>
public int PageSize [Description("每页显示数量"), Category("自定义")]
public virtual int PageSize
{ {
get { return m_pageSize; } get { return m_pageSize; }
set { m_pageSize = value; } set { m_pageSize = value; }
...@@ -67,7 +73,8 @@ namespace HZH_Controls.Controls ...@@ -67,7 +73,8 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 开始的下标 /// 开始的下标
/// </summary> /// </summary>
public int StartIndex [Description("开始的下标"), Category("自定义")]
public virtual int StartIndex
{ {
get { return startIndex; } get { return startIndex; }
set set
...@@ -83,18 +90,38 @@ namespace HZH_Controls.Controls ...@@ -83,18 +90,38 @@ namespace HZH_Controls.Controls
{ {
InitializeComponent(); InitializeComponent();
} }
public void FirstPage()
private void UCPagerControlBase_Load(object sender, EventArgs e)
{
if (DataSource == null)
ShowBtn(false, false);
else
{
ShowBtn(false, DataSource.Count > PageSize);
}
}
/// <summary>
/// 第一页
/// </summary>
public virtual void FirstPage()
{ {
if (DataSource == null)
return;
startIndex = 0; startIndex = 0;
var s = GetCurrentSource(); var s = GetCurrentSource();
if (ShowChanged != null) if (ShowSourceChanged != null)
{ {
ShowChanged(s); ShowSourceChanged(s);
} }
} }
public void PreviousPage() /// <summary>
/// 上一页
/// </summary>
public virtual void PreviousPage()
{ {
if (DataSource == null)
return;
if (startIndex == 0) if (startIndex == 0)
return; return;
startIndex -= m_pageSize; startIndex -= m_pageSize;
...@@ -102,13 +129,18 @@ namespace HZH_Controls.Controls ...@@ -102,13 +129,18 @@ namespace HZH_Controls.Controls
startIndex = 0; startIndex = 0;
var s = GetCurrentSource(); var s = GetCurrentSource();
if (ShowChanged != null) if (ShowSourceChanged != null)
{ {
ShowChanged(s); ShowSourceChanged(s);
} }
} }
public void NextPage() /// <summary>
/// 下一页
/// </summary>
public virtual void NextPage()
{ {
if (DataSource == null)
return;
if (startIndex + m_pageSize >= DataSource.Count) if (startIndex + m_pageSize >= DataSource.Count)
{ {
return; return;
...@@ -118,38 +150,47 @@ namespace HZH_Controls.Controls ...@@ -118,38 +150,47 @@ namespace HZH_Controls.Controls
startIndex = 0; startIndex = 0;
var s = GetCurrentSource(); var s = GetCurrentSource();
if (ShowChanged != null) if (ShowSourceChanged != null)
{ {
ShowChanged(s); ShowSourceChanged(s);
} }
} }
/// <summary>
public void EndPage() /// 最后一页
/// </summary>
public virtual void EndPage()
{ {
startIndex = DataSource.Count - 1 - m_pageSize; if (DataSource == null)
return;
startIndex = DataSource.Count - m_pageSize;
if (startIndex < 0) if (startIndex < 0)
startIndex = 0; startIndex = 0;
var s = GetCurrentSource(); var s = GetCurrentSource();
if (ShowChanged != null) if (ShowSourceChanged != null)
{ {
ShowChanged(s); ShowSourceChanged(s);
} }
} }
/// <summary>
public void Reload() /// 刷新数据
/// </summary>
public virtual void Reload()
{ {
var s = GetCurrentSource(); var s = GetCurrentSource();
if (ShowChanged != null) if (ShowSourceChanged != null)
{ {
ShowChanged(s); ShowSourceChanged(s);
} }
} }
/// <summary>
/// 获取当前页数据
/// </summary>
public List<object> GetCurrentSource() /// <returns></returns>
public virtual List<object> GetCurrentSource()
{ {
if (DataSource == null)
return null;
int intShowCount = m_pageSize; int intShowCount = m_pageSize;
if (intShowCount + startIndex > DataSource.Count) if (intShowCount + startIndex > DataSource.Count)
intShowCount = DataSource.Count - startIndex; intShowCount = DataSource.Count - startIndex;
...@@ -185,9 +226,11 @@ namespace HZH_Controls.Controls ...@@ -185,9 +226,11 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// 控制按钮显示 /// 控制按钮显示
/// </summary> /// </summary>
/// <param name="blnLeftBtn"></param> /// <param name="blnLeftBtn">是否显示上一页,第一页</param>
/// <param name="blnRightBtn"></param> /// <param name="blnRightBtn">是否显示下一页,最后一页</param>
protected virtual void ShowBtn(bool blnLeftBtn, bool blnRightBtn) protected virtual void ShowBtn(bool blnLeftBtn, bool blnRightBtn)
{ } { }
} }
} }
...@@ -23,6 +23,7 @@ namespace HZH_Controls.Forms ...@@ -23,6 +23,7 @@ namespace HZH_Controls.Forms
/// </summary> /// </summary>
public partial class FrmAnchor : Form, IMessageFilter public partial class FrmAnchor : Form, IMessageFilter
{ {
Control m_parentControl = null;
private bool blnDown = true; private bool blnDown = true;
#region 构造函数 #region 构造函数
/// <summary> /// <summary>
...@@ -36,6 +37,7 @@ namespace HZH_Controls.Forms ...@@ -36,6 +37,7 @@ namespace HZH_Controls.Forms
/// <param name="deviation">偏移</param> /// <param name="deviation">偏移</param>
public FrmAnchor(Control parentControl, Control childControl, Point? deviation = null) public FrmAnchor(Control parentControl, Control childControl, Point? deviation = null)
{ {
m_parentControl = parentControl;
InitializeComponent(); InitializeComponent();
this.Size = childControl.Size; this.Size = childControl.Size;
this.HandleCreated += FrmDownBoard_HandleCreated; this.HandleCreated += FrmDownBoard_HandleCreated;
...@@ -75,6 +77,7 @@ namespace HZH_Controls.Forms ...@@ -75,6 +77,7 @@ namespace HZH_Controls.Forms
public FrmAnchor(Control parentControl, Size size, Point? deviation = null) public FrmAnchor(Control parentControl, Size size, Point? deviation = null)
{ {
m_parentControl = parentControl;
InitializeComponent(); InitializeComponent();
this.Size = size; this.Size = size;
this.HandleCreated += FrmDownBoard_HandleCreated; this.HandleCreated += FrmDownBoard_HandleCreated;
......
...@@ -363,9 +363,9 @@ namespace HZH_Controls.Forms ...@@ -363,9 +363,9 @@ namespace HZH_Controls.Forms
public enum TipsState public enum TipsState
{ {
Default = -1, Default = -1,
Success = -11426991, Success = -6566849,
Info = -13658444, Info = -12477983,
Warning = -486394, Warning = -357816,
Error = -4377041 Error = -1097849
} }
} }
...@@ -412,6 +412,7 @@ ...@@ -412,6 +412,7 @@
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="ClassDiagram1.cd" />
<None Include="Resources\alarm.png" /> <None Include="Resources\alarm.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
...@@ -40,25 +40,29 @@ ...@@ -40,25 +40,29 @@
this.button7 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button(); this.button8 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.groupBox7 = new System.Windows.Forms.GroupBox(); this.groupBox7 = new System.Windows.Forms.GroupBox();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.groupBox8 = new System.Windows.Forms.GroupBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button9 = new System.Windows.Forms.Button();
this.ucHorizontalList1 = new HZH_Controls.Controls.UCHorizontalList();
this.ucDatePickerExt3 = new HZH_Controls.Controls.UCDatePickerExt(); this.ucDatePickerExt3 = new HZH_Controls.Controls.UCDatePickerExt();
this.ucDatePickerExt2 = new HZH_Controls.Controls.UCDatePickerExt(); this.ucDatePickerExt2 = new HZH_Controls.Controls.UCDatePickerExt();
this.ucDatePickerExt1 = new HZH_Controls.Controls.UCDatePickerExt(); this.ucDatePickerExt1 = new HZH_Controls.Controls.UCDatePickerExt();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.ucComboBox2 = new HZH_Controls.Controls.UCComboBox(); this.ucComboBox2 = new HZH_Controls.Controls.UCComboBox();
this.ucComboBox1 = new HZH_Controls.Controls.UCComboBox(); this.ucComboBox1 = new HZH_Controls.Controls.UCComboBox();
this.groupBox8 = new System.Windows.Forms.GroupBox();
this.ucListExt1 = new HZH_Controls.Controls.UCListExt(); this.ucListExt1 = new HZH_Controls.Controls.UCListExt();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.treeViewEx1 = new HZH_Controls.Controls.TreeViewEx(); this.treeViewEx1 = new HZH_Controls.Controls.TreeViewEx();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.ucTextBoxEx4 = new HZH_Controls.Controls.UCTextBoxEx(); this.ucTextBoxEx4 = new HZH_Controls.Controls.UCTextBoxEx();
this.ucTextBoxEx3 = new HZH_Controls.Controls.UCTextBoxEx(); this.ucTextBoxEx3 = new HZH_Controls.Controls.UCTextBoxEx();
this.ucTextBoxEx2 = new HZH_Controls.Controls.UCTextBoxEx(); this.ucTextBoxEx2 = new HZH_Controls.Controls.UCTextBoxEx();
this.ucTextBoxEx1 = new HZH_Controls.Controls.UCTextBoxEx(); this.ucTextBoxEx1 = new HZH_Controls.Controls.UCTextBoxEx();
this.ucNumTextBox1 = new HZH_Controls.Controls.UCNumTextBox(); this.ucNumTextBox1 = new HZH_Controls.Controls.UCNumTextBox();
this.textBoxTransparent1 = new HZH_Controls.Controls.TextBoxTransparent(); this.textBoxTransparent1 = new HZH_Controls.Controls.TextBoxTransparent();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.ucCheckBox4 = new HZH_Controls.Controls.UCCheckBox(); this.ucCheckBox4 = new HZH_Controls.Controls.UCCheckBox();
this.ucCheckBox3 = new HZH_Controls.Controls.UCCheckBox(); this.ucCheckBox3 = new HZH_Controls.Controls.UCCheckBox();
this.ucCheckBox2 = new HZH_Controls.Controls.UCCheckBox(); this.ucCheckBox2 = new HZH_Controls.Controls.UCCheckBox();
...@@ -67,14 +71,13 @@ ...@@ -67,14 +71,13 @@
this.ucRadioButton3 = new HZH_Controls.Controls.UCRadioButton(); this.ucRadioButton3 = new HZH_Controls.Controls.UCRadioButton();
this.ucRadioButton2 = new HZH_Controls.Controls.UCRadioButton(); this.ucRadioButton2 = new HZH_Controls.Controls.UCRadioButton();
this.ucRadioButton1 = new HZH_Controls.Controls.UCRadioButton(); this.ucRadioButton1 = new HZH_Controls.Controls.UCRadioButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.ucBtnImg1 = new HZH_Controls.Controls.UCBtnImg(); this.ucBtnImg1 = new HZH_Controls.Controls.UCBtnImg();
this.ucBtnFillet1 = new HZH_Controls.Controls.UCBtnFillet(); this.ucBtnFillet1 = new HZH_Controls.Controls.UCBtnFillet();
this.ucBtnExt2 = new HZH_Controls.Controls.UCBtnExt(); this.ucBtnExt2 = new HZH_Controls.Controls.UCBtnExt();
this.ucBtnExt1 = new HZH_Controls.Controls.UCBtnExt(); this.ucBtnExt1 = new HZH_Controls.Controls.UCBtnExt();
this.groupBox9 = new System.Windows.Forms.GroupBox(); this.comboBox1 = new System.Windows.Forms.ComboBox();
this.ucHorizontalList1 = new HZH_Controls.Controls.UCHorizontalList();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox9.SuspendLayout();
this.groupBox7.SuspendLayout(); this.groupBox7.SuspendLayout();
this.groupBox6.SuspendLayout(); this.groupBox6.SuspendLayout();
this.groupBox8.SuspendLayout(); this.groupBox8.SuspendLayout();
...@@ -82,7 +85,6 @@ ...@@ -82,7 +85,6 @@
this.groupBox4.SuspendLayout(); this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox9.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// timer1 // timer1
...@@ -187,6 +189,16 @@ ...@@ -187,6 +189,16 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "控件"; this.groupBox1.Text = "控件";
// //
// groupBox9
//
this.groupBox9.Controls.Add(this.ucHorizontalList1);
this.groupBox9.Location = new System.Drawing.Point(625, 380);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(485, 102);
this.groupBox9.TabIndex = 8;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "横向列表";
//
// groupBox7 // groupBox7
// //
this.groupBox7.Controls.Add(this.ucDatePickerExt3); this.groupBox7.Controls.Add(this.ucDatePickerExt3);
...@@ -199,6 +211,102 @@ ...@@ -199,6 +211,102 @@
this.groupBox7.TabStop = false; this.groupBox7.TabStop = false;
this.groupBox7.Text = "日历"; this.groupBox7.Text = "日历";
// //
// groupBox6
//
this.groupBox6.Controls.Add(this.ucComboBox2);
this.groupBox6.Controls.Add(this.ucComboBox1);
this.groupBox6.Location = new System.Drawing.Point(25, 363);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(187, 119);
this.groupBox6.TabIndex = 6;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "下拉列表";
//
// groupBox8
//
this.groupBox8.Controls.Add(this.ucListExt1);
this.groupBox8.Location = new System.Drawing.Point(876, 30);
this.groupBox8.Name = "groupBox8";
this.groupBox8.Size = new System.Drawing.Size(240, 324);
this.groupBox8.TabIndex = 4;
this.groupBox8.TabStop = false;
this.groupBox8.Text = "列表";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.treeViewEx1);
this.groupBox5.Location = new System.Drawing.Point(625, 30);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(240, 327);
this.groupBox5.TabIndex = 4;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "树";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.ucTextBoxEx4);
this.groupBox4.Controls.Add(this.ucTextBoxEx3);
this.groupBox4.Controls.Add(this.ucTextBoxEx2);
this.groupBox4.Controls.Add(this.ucTextBoxEx1);
this.groupBox4.Controls.Add(this.ucNumTextBox1);
this.groupBox4.Controls.Add(this.textBoxTransparent1);
this.groupBox4.Location = new System.Drawing.Point(397, 30);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(209, 327);
this.groupBox4.TabIndex = 2;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "文本框";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.ucCheckBox4);
this.groupBox3.Controls.Add(this.ucCheckBox3);
this.groupBox3.Controls.Add(this.ucCheckBox2);
this.groupBox3.Controls.Add(this.ucCheckBox1);
this.groupBox3.Controls.Add(this.ucRadioButton4);
this.groupBox3.Controls.Add(this.ucRadioButton3);
this.groupBox3.Controls.Add(this.ucRadioButton2);
this.groupBox3.Controls.Add(this.ucRadioButton1);
this.groupBox3.Location = new System.Drawing.Point(232, 30);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(149, 327);
this.groupBox3.TabIndex = 1;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "单选/复选";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.ucBtnImg1);
this.groupBox2.Controls.Add(this.ucBtnFillet1);
this.groupBox2.Controls.Add(this.ucBtnExt2);
this.groupBox2.Controls.Add(this.ucBtnExt1);
this.groupBox2.Location = new System.Drawing.Point(25, 30);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(187, 327);
this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "按钮";
//
// button9
//
this.button9.Location = new System.Drawing.Point(964, 34);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(116, 23);
this.button9.TabIndex = 0;
this.button9.Text = "FrmAnchor2";
this.button9.UseVisualStyleBackColor = true;
this.button9.Click += new System.EventHandler(this.button9_Click);
//
// ucHorizontalList1
//
this.ucHorizontalList1.DataSource = null;
this.ucHorizontalList1.IsAutoSelectFirst = true;
this.ucHorizontalList1.Location = new System.Drawing.Point(6, 25);
this.ucHorizontalList1.Name = "ucHorizontalList1";
this.ucHorizontalList1.SelectedItem = null;
this.ucHorizontalList1.Size = new System.Drawing.Size(473, 53);
this.ucHorizontalList1.TabIndex = 0;
//
// ucDatePickerExt3 // ucDatePickerExt3
// //
this.ucDatePickerExt3.BackColor = System.Drawing.Color.Transparent; this.ucDatePickerExt3.BackColor = System.Drawing.Color.Transparent;
...@@ -259,17 +367,6 @@ ...@@ -259,17 +367,6 @@
this.ucDatePickerExt1.TimeFontSize = 20; this.ucDatePickerExt1.TimeFontSize = 20;
this.ucDatePickerExt1.TimeType = HZH_Controls.Controls.DateTimePickerType.DateTime; this.ucDatePickerExt1.TimeType = HZH_Controls.Controls.DateTimePickerType.DateTime;
// //
// groupBox6
//
this.groupBox6.Controls.Add(this.ucComboBox2);
this.groupBox6.Controls.Add(this.ucComboBox1);
this.groupBox6.Location = new System.Drawing.Point(25, 363);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(187, 119);
this.groupBox6.TabIndex = 6;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "下拉列表";
//
// ucComboBox2 // ucComboBox2
// //
this.ucComboBox2.BackColor = System.Drawing.Color.Transparent; this.ucComboBox2.BackColor = System.Drawing.Color.Transparent;
...@@ -318,16 +415,6 @@ ...@@ -318,16 +415,6 @@
this.ucComboBox1.TabIndex = 5; this.ucComboBox1.TabIndex = 5;
this.ucComboBox1.TextValue = null; this.ucComboBox1.TextValue = null;
// //
// groupBox8
//
this.groupBox8.Controls.Add(this.ucListExt1);
this.groupBox8.Location = new System.Drawing.Point(876, 30);
this.groupBox8.Name = "groupBox8";
this.groupBox8.Size = new System.Drawing.Size(240, 324);
this.groupBox8.TabIndex = 4;
this.groupBox8.TabStop = false;
this.groupBox8.Text = "列表";
//
// ucListExt1 // ucListExt1
// //
this.ucListExt1.AutoScroll = true; this.ucListExt1.AutoScroll = true;
...@@ -348,16 +435,6 @@ ...@@ -348,16 +435,6 @@
this.ucListExt1.Title2Font = new System.Drawing.Font("微软雅黑", 14F); this.ucListExt1.Title2Font = new System.Drawing.Font("微软雅黑", 14F);
this.ucListExt1.TitleFont = new System.Drawing.Font("微软雅黑", 15F); this.ucListExt1.TitleFont = new System.Drawing.Font("微软雅黑", 15F);
// //
// groupBox5
//
this.groupBox5.Controls.Add(this.treeViewEx1);
this.groupBox5.Location = new System.Drawing.Point(625, 30);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(240, 327);
this.groupBox5.TabIndex = 4;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "树";
//
// treeViewEx1 // treeViewEx1
// //
this.treeViewEx1.BackColor = System.Drawing.Color.White; this.treeViewEx1.BackColor = System.Drawing.Color.White;
...@@ -390,21 +467,6 @@ ...@@ -390,21 +467,6 @@
this.treeViewEx1.TipFont = new System.Drawing.Font("Arial Unicode MS", 12F); this.treeViewEx1.TipFont = new System.Drawing.Font("Arial Unicode MS", 12F);
this.treeViewEx1.TipImage = ((System.Drawing.Image)(resources.GetObject("treeViewEx1.TipImage"))); this.treeViewEx1.TipImage = ((System.Drawing.Image)(resources.GetObject("treeViewEx1.TipImage")));
// //
// groupBox4
//
this.groupBox4.Controls.Add(this.ucTextBoxEx4);
this.groupBox4.Controls.Add(this.ucTextBoxEx3);
this.groupBox4.Controls.Add(this.ucTextBoxEx2);
this.groupBox4.Controls.Add(this.ucTextBoxEx1);
this.groupBox4.Controls.Add(this.ucNumTextBox1);
this.groupBox4.Controls.Add(this.textBoxTransparent1);
this.groupBox4.Location = new System.Drawing.Point(397, 30);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(209, 327);
this.groupBox4.TabIndex = 2;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "文本框";
//
// ucTextBoxEx4 // ucTextBoxEx4
// //
this.ucTextBoxEx4.BackColor = System.Drawing.Color.Transparent; this.ucTextBoxEx4.BackColor = System.Drawing.Color.Transparent;
...@@ -621,23 +683,6 @@ ...@@ -621,23 +683,6 @@
this.textBoxTransparent1.TabIndex = 0; this.textBoxTransparent1.TabIndex = 0;
this.textBoxTransparent1.Text = "这是一个透明文本框"; this.textBoxTransparent1.Text = "这是一个透明文本框";
// //
// groupBox3
//
this.groupBox3.Controls.Add(this.ucCheckBox4);
this.groupBox3.Controls.Add(this.ucCheckBox3);
this.groupBox3.Controls.Add(this.ucCheckBox2);
this.groupBox3.Controls.Add(this.ucCheckBox1);
this.groupBox3.Controls.Add(this.ucRadioButton4);
this.groupBox3.Controls.Add(this.ucRadioButton3);
this.groupBox3.Controls.Add(this.ucRadioButton2);
this.groupBox3.Controls.Add(this.ucRadioButton1);
this.groupBox3.Location = new System.Drawing.Point(232, 30);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(149, 327);
this.groupBox3.TabIndex = 1;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "单选/复选";
//
// ucCheckBox4 // ucCheckBox4
// //
this.ucCheckBox4.BackColor = System.Drawing.Color.Transparent; this.ucCheckBox4.BackColor = System.Drawing.Color.Transparent;
...@@ -722,19 +767,6 @@ ...@@ -722,19 +767,6 @@
this.ucRadioButton1.TabIndex = 0; this.ucRadioButton1.TabIndex = 0;
this.ucRadioButton1.TextValue = "单选按钮1"; this.ucRadioButton1.TextValue = "单选按钮1";
// //
// groupBox2
//
this.groupBox2.Controls.Add(this.ucBtnImg1);
this.groupBox2.Controls.Add(this.ucBtnFillet1);
this.groupBox2.Controls.Add(this.ucBtnExt2);
this.groupBox2.Controls.Add(this.ucBtnExt1);
this.groupBox2.Location = new System.Drawing.Point(25, 30);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(187, 327);
this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "按钮";
//
// ucBtnImg1 // ucBtnImg1
// //
this.ucBtnImg1.BackColor = System.Drawing.Color.White; this.ucBtnImg1.BackColor = System.Drawing.Color.White;
...@@ -827,36 +859,35 @@ ...@@ -827,36 +859,35 @@
this.ucBtnExt1.TabStop = false; this.ucBtnExt1.TabStop = false;
this.ucBtnExt1.TipsText = ""; this.ucBtnExt1.TipsText = "";
// //
// groupBox9 // comboBox1
// //
this.groupBox9.Controls.Add(this.ucHorizontalList1); this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.groupBox9.Location = new System.Drawing.Point(625, 380); this.comboBox1.FormattingEnabled = true;
this.groupBox9.Name = "groupBox9"; this.comboBox1.Items.AddRange(new object[] {
this.groupBox9.Size = new System.Drawing.Size(485, 102); "1",
this.groupBox9.TabIndex = 8; "2",
this.groupBox9.TabStop = false; "3",
this.groupBox9.Text = "横向列表"; "4",
// "54",
// ucHorizontalList1 "6",
// "787"});
this.ucHorizontalList1.DataSource = null; this.comboBox1.Location = new System.Drawing.Point(394, 585);
this.ucHorizontalList1.IsAutoSelectFirst = true; this.comboBox1.Name = "comboBox1";
this.ucHorizontalList1.Location = new System.Drawing.Point(6, 25); this.comboBox1.Size = new System.Drawing.Size(121, 20);
this.ucHorizontalList1.Name = "ucHorizontalList1"; this.comboBox1.TabIndex = 2;
this.ucHorizontalList1.SelectedItem = null;
this.ucHorizontalList1.Size = new System.Drawing.Size(473, 53);
this.ucHorizontalList1.TabIndex = 0;
// //
// Form1 // Form1
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1176, 616); this.ClientSize = new System.Drawing.Size(1176, 616);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button5); this.Controls.Add(this.button5);
this.Controls.Add(this.button4); this.Controls.Add(this.button4);
this.Controls.Add(this.button3); this.Controls.Add(this.button3);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.button9);
this.Controls.Add(this.button8); this.Controls.Add(this.button8);
this.Controls.Add(this.button7); this.Controls.Add(this.button7);
this.Controls.Add(this.button6); this.Controls.Add(this.button6);
...@@ -865,6 +896,7 @@ ...@@ -865,6 +896,7 @@
this.Text = "Form1"; this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox9.ResumeLayout(false);
this.groupBox7.ResumeLayout(false); this.groupBox7.ResumeLayout(false);
this.groupBox6.ResumeLayout(false); this.groupBox6.ResumeLayout(false);
this.groupBox8.ResumeLayout(false); this.groupBox8.ResumeLayout(false);
...@@ -873,7 +905,6 @@ ...@@ -873,7 +905,6 @@
this.groupBox4.PerformLayout(); this.groupBox4.PerformLayout();
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.groupBox9.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
...@@ -924,6 +955,8 @@ ...@@ -924,6 +955,8 @@
private HZH_Controls.Controls.UCListExt ucListExt1; private HZH_Controls.Controls.UCListExt ucListExt1;
private System.Windows.Forms.GroupBox groupBox9; private System.Windows.Forms.GroupBox groupBox9;
private HZH_Controls.Controls.UCHorizontalList ucHorizontalList1; private HZH_Controls.Controls.UCHorizontalList ucHorizontalList1;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.ComboBox comboBox1;
} }
} }
...@@ -57,13 +57,13 @@ namespace Test ...@@ -57,13 +57,13 @@ namespace Test
} }
this.ucListExt1.SetList(lst); this.ucListExt1.SetList(lst);
List<KeyValuePair<string, string>> lstHL = new List<KeyValuePair<string, string>>(); List<KeyValuePair<string, string>> lstHL = new List<KeyValuePair<string, string>>();
for (int i = 0; i < 30; i++) for (int i = 0; i < 30; i++)
{ {
lstHL.Add(new KeyValuePair<string, string>(i.ToString(), "选项" + i)); lstHL.Add(new KeyValuePair<string, string>(i.ToString(), "选项" + i));
} }
this.ucHorizontalList1.DataSource = lstHL; this.ucHorizontalList1.DataSource = lstHL;
} }
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
...@@ -135,5 +135,10 @@ this.ucHorizontalList1.DataSource = lstHL; ...@@ -135,5 +135,10 @@ this.ucHorizontalList1.DataSource = lstHL;
frm.ShowDialog(this); frm.ShowDialog(this);
} }
private void button9_Click(object sender, EventArgs e)
{
}
} }
} }
...@@ -18,8 +18,7 @@ namespace Test ...@@ -18,8 +18,7 @@ namespace Test
} }
private void FrmTemp1Test_Load(object sender, EventArgs e) private void FrmTemp1Test_Load(object sender, EventArgs e)
{ {
List<DataGridViewColumnEntity> lstCulumns = new List<DataGridViewColumnEntity>(); List<DataGridViewColumnEntity> lstCulumns = new List<DataGridViewColumnEntity>();
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "ID", HeadText = "编号", Width = 70, WidthType = SizeType.Absolute }); lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "ID", HeadText = "编号", Width = 70, WidthType = SizeType.Absolute });
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Name", HeadText = "姓名", Width = 50, WidthType = SizeType.Percent }); lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Name", HeadText = "姓名", Width = 50, WidthType = SizeType.Percent });
...@@ -27,7 +26,7 @@ namespace Test ...@@ -27,7 +26,7 @@ namespace Test
this.ucDataGridView1.Columns = lstCulumns; this.ucDataGridView1.Columns = lstCulumns;
this.ucDataGridView1.IsShowCheckBox = true; this.ucDataGridView1.IsShowCheckBox = true;
List<object> lstSource = new List<object>(); List<object> lstSource = new List<object>();
for (int i = 0; i < 10; i++) for (int i = 0; i < 20; i++)
{ {
TestModel model = new TestModel() TestModel model = new TestModel()
{ {
...@@ -38,7 +37,9 @@ namespace Test ...@@ -38,7 +37,9 @@ namespace Test
lstSource.Add(model); lstSource.Add(model);
} }
this.ucDataGridView1.DataSource = lstSource.ToArray(); UCPagerControl page = new UCPagerControl();
page.DataSource = lstSource;
this.ucDataGridView1.Page = page;
this.ucDataGridView1.First(); this.ucDataGridView1.First();
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!