Commit 2be47940 HZH

解决树表格,行高度问题

1 个父辈 2e54711e
...@@ -117,7 +117,7 @@ namespace HZH_Controls.Controls ...@@ -117,7 +117,7 @@ namespace HZH_Controls.Controls
this.ucDataGridView1.HeadHeight = 40; this.ucDataGridView1.HeadHeight = 40;
this.ucDataGridView1.HeadPadingLeft = 0; this.ucDataGridView1.HeadPadingLeft = 0;
this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black; this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black;
this.ucDataGridView1.IsAutoHeight = false; this.ucDataGridView1.IsCloseAutoHeight = false;
this.ucDataGridView1.IsShowCheckBox = false; this.ucDataGridView1.IsShowCheckBox = false;
this.ucDataGridView1.IsShowHead = true; this.ucDataGridView1.IsShowHead = true;
this.ucDataGridView1.Location = new System.Drawing.Point(5, 5); this.ucDataGridView1.Location = new System.Drawing.Point(5, 5);
......
...@@ -105,7 +105,7 @@ namespace HZH_Controls.Controls ...@@ -105,7 +105,7 @@ namespace HZH_Controls.Controls
{ {
InitializeComponent(); InitializeComponent();
this.ucDataGridView1.Page = m_page; this.ucDataGridView1.Page = m_page;
this.ucDataGridView1.IsAutoHeight = false; this.ucDataGridView1.IsCloseAutoHeight = false;
this.txtSearch.txtInput.TextChanged += txtInput_TextChanged; this.txtSearch.txtInput.TextChanged += txtInput_TextChanged;
this.ucDataGridView1.ItemClick += ucDataGridView1_ItemClick; this.ucDataGridView1.ItemClick += ucDataGridView1_ItemClick;
} }
......
...@@ -260,6 +260,8 @@ namespace HZH_Controls.Controls ...@@ -260,6 +260,8 @@ namespace HZH_Controls.Controls
if (!typeof(IDataGridViewRow).IsAssignableFrom(value) || !value.IsSubclassOf(typeof(Control))) if (!typeof(IDataGridViewRow).IsAssignableFrom(value) || !value.IsSubclassOf(typeof(Control)))
throw new Exception("行控件没有实现IDataGridViewRow接口"); throw new Exception("行控件没有实现IDataGridViewRow接口");
m_rowType = value; m_rowType = value;
if (value == typeof(UCDataGridViewTreeRow))
IsCloseAutoHeight = true;
ResetShowCount(); ResetShowCount();
if (m_columns != null && m_columns.Count > 0) if (m_columns != null && m_columns.Count > 0)
ReloadSource(); ReloadSource();
...@@ -385,18 +387,18 @@ namespace HZH_Controls.Controls ...@@ -385,18 +387,18 @@ namespace HZH_Controls.Controls
/// <summary> /// <summary>
/// The m is automatic height /// The m is automatic height
/// </summary> /// </summary>
private bool m_isAutoHeight = false; private bool m_isCloseAutoHeight = false;
/// <summary> /// <summary>
/// 自动适应最大高度(当为true时,需要手动计算高度,请慎用) /// 自动适应最大高度(当为true时,需要手动计算高度,请慎用)
/// </summary> /// </summary>
/// <value><c>true</c> if this instance is automatic height; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is automatic height; otherwise, <c>false</c>.</value>
[Browsable(false)] [Browsable(false)]
public bool IsAutoHeight public bool IsCloseAutoHeight
{ {
get { return m_isAutoHeight; } get { return m_isCloseAutoHeight; }
set set
{ {
m_isAutoHeight = value; m_isCloseAutoHeight = value;
this.AutoScroll = value; this.AutoScroll = value;
} }
} }
...@@ -838,7 +840,7 @@ namespace HZH_Controls.Controls ...@@ -838,7 +840,7 @@ namespace HZH_Controls.Controls
{ {
if (this.Height <= 0) if (this.Height <= 0)
return; return;
if (m_isAutoHeight) if (m_isCloseAutoHeight)
return; return;
ResetShowCount(); ResetShowCount();
ReloadSource(); ReloadSource();
......
...@@ -136,7 +136,7 @@ namespace HZH_Controls.Controls ...@@ -136,7 +136,7 @@ namespace HZH_Controls.Controls
this.ucDGVChild.HeadHeight = 40; this.ucDGVChild.HeadHeight = 40;
this.ucDGVChild.HeadPadingLeft = 0; this.ucDGVChild.HeadPadingLeft = 0;
this.ucDGVChild.HeadTextColor = System.Drawing.Color.Black; this.ucDGVChild.HeadTextColor = System.Drawing.Color.Black;
this.ucDGVChild.IsAutoHeight = false; this.ucDGVChild.IsCloseAutoHeight = false;
this.ucDGVChild.IsShowCheckBox = false; this.ucDGVChild.IsShowCheckBox = false;
this.ucDGVChild.IsShowHead = false; this.ucDGVChild.IsShowHead = false;
this.ucDGVChild.Location = new System.Drawing.Point(25, 0); this.ucDGVChild.Location = new System.Drawing.Point(25, 0);
......
...@@ -137,7 +137,7 @@ namespace HZH_Controls.Controls ...@@ -137,7 +137,7 @@ namespace HZH_Controls.Controls
{ {
InitializeComponent(); InitializeComponent();
this.ucDGVChild.RowType = this.GetType(); this.ucDGVChild.RowType = this.GetType();
this.ucDGVChild.IsAutoHeight = true; this.ucDGVChild.IsCloseAutoHeight = true;
this.SizeChanged += UCDataGridViewTreeRow_SizeChanged; this.SizeChanged += UCDataGridViewTreeRow_SizeChanged;
this.ucDGVChild.ItemClick += (a, b) => this.ucDGVChild.ItemClick += (a, b) =>
{ {
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
this.ucDataGridView1.HeadHeight = 40; this.ucDataGridView1.HeadHeight = 40;
this.ucDataGridView1.HeadPadingLeft = 24; this.ucDataGridView1.HeadPadingLeft = 24;
this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black; this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black;
this.ucDataGridView1.IsAutoHeight = false; this.ucDataGridView1.IsCloseAutoHeight = false;
this.ucDataGridView1.IsShowCheckBox = false; this.ucDataGridView1.IsShowCheckBox = false;
this.ucDataGridView1.IsShowHead = true; this.ucDataGridView1.IsShowHead = true;
this.ucDataGridView1.Location = new System.Drawing.Point(0, 61); this.ucDataGridView1.Location = new System.Drawing.Point(0, 61);
......
...@@ -20,7 +20,6 @@ namespace Test ...@@ -20,7 +20,6 @@ namespace Test
private void FrmTemp1Test_Load(object sender, EventArgs e) private void FrmTemp1Test_Load(object sender, EventArgs e)
{ {
this.ucDataGridView1.RowType = typeof(UCDataGridViewTreeRow); this.ucDataGridView1.RowType = typeof(UCDataGridViewTreeRow);
this.ucDataGridView1.IsAutoHeight = true;
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 });
...@@ -42,7 +41,7 @@ namespace Test ...@@ -42,7 +41,7 @@ namespace Test
Sex = i % 2 Sex = i % 2
}; };
lstSource.Add(model); lstSource.Add(model);
//AddChilds(model, 5); AddChilds(model, 5);
} }
var page = new UCPagerControl2(); var page = new UCPagerControl2();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!