Commit 2be47940 HZH

解决树表格,行高度问题

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