Commit 297dd00a HZH

add treeGrid

1 个父辈 94da23c3
...@@ -54,5 +54,9 @@ namespace HZH_Controls.Controls ...@@ -54,5 +54,9 @@ namespace HZH_Controls.Controls
/// </summary> /// </summary>
/// <param name="blnSelected">是否选中</param> /// <param name="blnSelected">是否选中</param>
void SetSelect(bool blnSelected); void SetSelect(bool blnSelected);
/// <summary>
/// 行高
/// </summary>
int RowHeight { get; set; }
} }
} }
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
{ {
this.panHead = new System.Windows.Forms.Panel(); this.panHead = new System.Windows.Forms.Panel();
this.panColumns = new System.Windows.Forms.TableLayoutPanel(); this.panColumns = new System.Windows.Forms.TableLayoutPanel();
this.panHeadLeft = new System.Windows.Forms.Panel();
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.panPage = new System.Windows.Forms.Panel();
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
// panHead // panHead
// //
this.panHead.Controls.Add(this.panColumns); this.panHead.Controls.Add(this.panColumns);
this.panHead.Controls.Add(this.panHeadLeft);
this.panHead.Controls.Add(this.ucSplitLine_H1); this.panHead.Controls.Add(this.ucSplitLine_H1);
this.panHead.Dock = System.Windows.Forms.DockStyle.Top; this.panHead.Dock = System.Windows.Forms.DockStyle.Top;
this.panHead.Location = new System.Drawing.Point(0, 0); this.panHead.Location = new System.Drawing.Point(0, 0);
...@@ -59,6 +61,14 @@ ...@@ -59,6 +61,14 @@
this.panColumns.Size = new System.Drawing.Size(1061, 39); this.panColumns.Size = new System.Drawing.Size(1061, 39);
this.panColumns.TabIndex = 1; this.panColumns.TabIndex = 1;
// //
// panHeadLeft
//
this.panHeadLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.panHeadLeft.Location = new System.Drawing.Point(0, 0);
this.panHeadLeft.Name = "panHeadLeft";
this.panHeadLeft.Size = new System.Drawing.Size(0, 39);
this.panHeadLeft.TabIndex = 2;
//
// ucSplitLine_H1 // ucSplitLine_H1
// //
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232))))); this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
...@@ -77,6 +87,7 @@ ...@@ -77,6 +87,7 @@
this.panRow.Name = "panRow"; this.panRow.Name = "panRow";
this.panRow.Size = new System.Drawing.Size(1061, 481); this.panRow.Size = new System.Drawing.Size(1061, 481);
this.panRow.TabIndex = 1; this.panRow.TabIndex = 1;
this.panRow.SizeChanged += new System.EventHandler(this.panRow_SizeChanged);
// //
// panPage // panPage
// //
...@@ -109,6 +120,7 @@ ...@@ -109,6 +120,7 @@
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; private System.Windows.Forms.Panel panPage;
private System.Windows.Forms.Panel panHeadLeft;
} }
} }
...@@ -59,7 +59,19 @@ namespace HZH_Controls.Controls ...@@ -59,7 +59,19 @@ namespace HZH_Controls.Controls
} }
} }
} }
int m_rowHeight = 40;
public int RowHeight
{
get
{
return m_rowHeight;
}
set
{
m_rowHeight = value;
this.Height = value;
}
}
#endregion #endregion
...@@ -97,7 +109,7 @@ namespace HZH_Controls.Controls ...@@ -97,7 +109,7 @@ namespace HZH_Controls.Controls
{ {
if (CellClick != null) if (CellClick != null)
{ {
CellClick(sender, new DataGridViewEventArgs() CellClick(this, new DataGridViewEventArgs()
{ {
CellControl = this, CellControl = this,
CellIndex = (sender as Control).Tag.ToInt() CellIndex = (sender as Control).Tag.ToInt()
...@@ -189,6 +201,5 @@ namespace HZH_Controls.Controls ...@@ -189,6 +201,5 @@ namespace HZH_Controls.Controls
} }
} }
} }
} }
namespace HZH_Controls.Controls
{
partial class UCDataGridViewTreeRow
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panCells = new System.Windows.Forms.TableLayoutPanel();
this.panLeft = new System.Windows.Forms.Panel();
this.panChildGrid = new System.Windows.Forms.Panel();
this.panChildLeft = new System.Windows.Forms.Panel();
this.panMain = new System.Windows.Forms.Panel();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.ucDGVChild = new HZH_Controls.Controls.UCDataGridView();
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
this.panChildGrid.SuspendLayout();
this.panMain.SuspendLayout();
this.SuspendLayout();
//
// panCells
//
this.panCells.ColumnCount = 1;
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.panCells.Dock = System.Windows.Forms.DockStyle.Fill;
this.panCells.Location = new System.Drawing.Point(24, 0);
this.panCells.Name = "panCells";
this.panCells.RowCount = 1;
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F));
this.panCells.Size = new System.Drawing.Size(637, 64);
this.panCells.TabIndex = 2;
//
// panLeft
//
this.panLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.panLeft.Location = new System.Drawing.Point(0, 0);
this.panLeft.Name = "panLeft";
this.panLeft.Size = new System.Drawing.Size(24, 64);
this.panLeft.TabIndex = 0;
this.panLeft.Tag = "0";
this.panLeft.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panLeft_MouseDown);
//
// panChildGrid
//
this.panChildGrid.Controls.Add(this.ucDGVChild);
this.panChildGrid.Controls.Add(this.ucSplitLine_V1);
this.panChildGrid.Controls.Add(this.panChildLeft);
this.panChildGrid.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panChildGrid.Location = new System.Drawing.Point(0, 65);
this.panChildGrid.Name = "panChildGrid";
this.panChildGrid.Size = new System.Drawing.Size(661, 0);
this.panChildGrid.TabIndex = 0;
this.panChildGrid.SizeChanged += new System.EventHandler(this.panChildGrid_SizeChanged);
//
// panChildLeft
//
this.panChildLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panChildLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.panChildLeft.Location = new System.Drawing.Point(0, 0);
this.panChildLeft.Name = "panChildLeft";
this.panChildLeft.Size = new System.Drawing.Size(24, 0);
this.panChildLeft.TabIndex = 1;
this.panChildLeft.Tag = "0";
//
// panMain
//
this.panMain.Controls.Add(this.panCells);
this.panMain.Controls.Add(this.panLeft);
this.panMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.panMain.Location = new System.Drawing.Point(0, 0);
this.panMain.Name = "panMain";
this.panMain.Size = new System.Drawing.Size(661, 64);
this.panMain.TabIndex = 0;
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 64);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(661, 1);
this.ucSplitLine_H1.TabIndex = 1;
this.ucSplitLine_H1.TabStop = false;
//
// ucDGVChild
//
this.ucDGVChild.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ucDGVChild.BackColor = System.Drawing.Color.White;
this.ucDGVChild.HeadFont = new System.Drawing.Font("微软雅黑", 12F);
this.ucDGVChild.HeadHeight = 40;
this.ucDGVChild.HeadPadingLeft = 0;
this.ucDGVChild.HeadTextColor = System.Drawing.Color.Black;
this.ucDGVChild.IsAutoHeight = 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);
this.ucDGVChild.TabIndex = 0;
this.ucDGVChild.SizeChanged += new System.EventHandler(this.ucDGVChild_SizeChanged);
//
// ucSplitLine_V1
//
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Left;
this.ucSplitLine_V1.Location = new System.Drawing.Point(24, 0);
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 0);
this.ucSplitLine_V1.TabIndex = 0;
this.ucSplitLine_V1.TabStop = false;
//
// UCDataGridViewTreeRow
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panMain);
this.Controls.Add(this.ucSplitLine_H1);
this.Controls.Add(this.panChildGrid);
this.Name = "UCDataGridViewTreeRow";
this.Size = new System.Drawing.Size(661, 65);
this.panChildGrid.ResumeLayout(false);
this.panMain.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel panCells;
private UCSplitLine_H ucSplitLine_H1;
private System.Windows.Forms.Panel panLeft;
private System.Windows.Forms.Panel panChildGrid;
private UCDataGridView ucDGVChild;
private System.Windows.Forms.Panel panChildLeft;
private System.Windows.Forms.Panel panMain;
private UCSplitLine_V ucSplitLine_V1;
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -65,6 +65,12 @@ ...@@ -65,6 +65,12 @@
<Compile Include="Controls\DataGridView\UCDataGridViewRow.Designer.cs"> <Compile Include="Controls\DataGridView\UCDataGridViewRow.Designer.cs">
<DependentUpon>UCDataGridViewRow.cs</DependentUpon> <DependentUpon>UCDataGridViewRow.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Controls\DataGridView\UCDataGridViewTreeRow.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\DataGridView\UCDataGridViewTreeRow.Designer.cs">
<DependentUpon>UCDataGridViewTreeRow.cs</DependentUpon>
</Compile>
<Compile Include="Controls\List\IListViewItem.cs" /> <Compile Include="Controls\List\IListViewItem.cs" />
<Compile Include="Controls\List\IPageControl.cs" /> <Compile Include="Controls\List\IPageControl.cs" />
<Compile Include="Controls\List\PageControlEventHandler.cs" /> <Compile Include="Controls\List\PageControlEventHandler.cs" />
...@@ -420,6 +426,9 @@ ...@@ -420,6 +426,9 @@
<EmbeddedResource Include="Controls\DataGridView\UCDataGridViewRow.resx"> <EmbeddedResource Include="Controls\DataGridView\UCDataGridViewRow.resx">
<DependentUpon>UCDataGridViewRow.cs</DependentUpon> <DependentUpon>UCDataGridViewRow.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Controls\DataGridView\UCDataGridViewTreeRow.resx">
<DependentUpon>UCDataGridViewTreeRow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\DateTime\UCDatePickerExt.resx"> <EmbeddedResource Include="Controls\DateTime\UCDatePickerExt.resx">
<DependentUpon>UCDatePickerExt.cs</DependentUpon> <DependentUpon>UCDatePickerExt.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
...@@ -671,6 +680,18 @@ ...@@ -671,6 +680,18 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\sanjiao1.png" /> <None Include="Resources\sanjiao1.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Resources\up.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\down.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\caret-down.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\caret-right.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PreBuildEvent>md "$(TargetDir)HandInput" <PreBuildEvent>md "$(TargetDir)HandInput"
......
...@@ -83,6 +83,26 @@ namespace HZH_Controls.Properties { ...@@ -83,6 +83,26 @@ namespace HZH_Controls.Properties {
/// <summary> /// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary> /// </summary>
internal static System.Drawing.Bitmap caret_down {
get {
object obj = ResourceManager.GetObject("caret_down", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap caret_right {
get {
object obj = ResourceManager.GetObject("caret_right", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap checkbox0 { internal static System.Drawing.Bitmap checkbox0 {
get { get {
object obj = ResourceManager.GetObject("checkbox0", resourceCulture); object obj = ResourceManager.GetObject("checkbox0", resourceCulture);
......
...@@ -229,4 +229,10 @@ ...@@ -229,4 +229,10 @@
<data name="sanjiao2" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="sanjiao2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sanjiao2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\sanjiao2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="caret_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\caret-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="caret_right" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\caret-right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>
\ No newline at end of file \ No newline at end of file
...@@ -34,11 +34,10 @@ ...@@ -34,11 +34,10 @@
// ucDataGridView1 // ucDataGridView1
// //
this.ucDataGridView1.BackColor = System.Drawing.Color.White; this.ucDataGridView1.BackColor = System.Drawing.Color.White;
this.ucDataGridView1.Columns = null;
this.ucDataGridView1.DataSource = null;
this.ucDataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.ucDataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ucDataGridView1.HeadFont = new System.Drawing.Font("微软雅黑", 12F); this.ucDataGridView1.HeadFont = new System.Drawing.Font("微软雅黑", 12F);
this.ucDataGridView1.HeadHeight = 40; this.ucDataGridView1.HeadHeight = 40;
this.ucDataGridView1.HeadPadingLeft = 24;
this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black; this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black;
this.ucDataGridView1.IsShowCheckBox = false; this.ucDataGridView1.IsShowCheckBox = false;
this.ucDataGridView1.IsShowHead = true; this.ucDataGridView1.IsShowHead = true;
......
...@@ -19,6 +19,9 @@ namespace Test ...@@ -19,6 +19,9 @@ 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.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 });
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Name", HeadText = "姓名", Width = 50, WidthType = SizeType.Percent }); lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Name", HeadText = "姓名", Width = 50, WidthType = SizeType.Percent });
...@@ -39,6 +42,7 @@ namespace Test ...@@ -39,6 +42,7 @@ namespace Test
Sex = i % 2 Sex = i % 2
}; };
lstSource.Add(model); lstSource.Add(model);
AddChilds(model, 5);
} }
var page = new UCPagerControl2(); var page = new UCPagerControl2();
...@@ -46,6 +50,26 @@ namespace Test ...@@ -46,6 +50,26 @@ namespace Test
this.ucDataGridView1.Page = page; this.ucDataGridView1.Page = page;
this.ucDataGridView1.First(); this.ucDataGridView1.First();
} }
private void AddChilds(TestModel tm, int intCount)
{
if (intCount <= 0)
return;
tm.Childrens = new List<TestModel>();
for (int i = 0; i < 5; i++)
{
TestModel model = new TestModel()
{
ID = i.ToString(),
Age = 3 * i,
Name = intCount + "——" + i,
Birthday = DateTime.Now.AddYears(-10),
Sex = i % 2
};
tm.Childrens.Add(model);
AddChilds(model, intCount - 1);
}
}
} }
public class TestModel public class TestModel
...@@ -55,5 +79,6 @@ namespace Test ...@@ -55,5 +79,6 @@ namespace Test
public int Age { get; set; } public int Age { get; set; }
public DateTime Birthday { get; set; } public DateTime Birthday { get; set; }
public int Sex { get; set; } public int Sex { get; set; }
public List<TestModel> Childrens { get; set; }
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!