Commit 800e772d HZH

新增穿梭

1 个父辈 a2e5cc9b
...@@ -337,6 +337,7 @@ namespace HZH_Controls.Controls ...@@ -337,6 +337,7 @@ namespace HZH_Controls.Controls
{ {
Control c = row as Control; Control c = row as Control;
UCDataGridView grid = FindChildGrid(c); UCDataGridView grid = FindChildGrid(c);
if (grid != null)
lst.AddRange(grid.SelectRows); lst.AddRange(grid.SelectRows);
} }
} }
...@@ -579,7 +580,7 @@ namespace HZH_Controls.Controls ...@@ -579,7 +580,7 @@ namespace HZH_Controls.Controls
try try
{ {
ControlHelper.FreezeControl(this.panRow, true); ControlHelper.FreezeControl(this.panRow, true);
this.panRow.Controls.Clear(); //this.panRow.Controls.Clear();
Rows = new List<IDataGridViewRow>(); Rows = new List<IDataGridViewRow>();
if (m_columns == null || m_columns.Count <= 0) if (m_columns == null || m_columns.Count <= 0)
return; return;
......
...@@ -144,6 +144,8 @@ namespace HZH_Controls.Controls ...@@ -144,6 +144,8 @@ namespace HZH_Controls.Controls
/// <returns>返回true则表示已处理过,否则将进行默认绑定(通常只针对有Text值的控件)</returns> /// <returns>返回true则表示已处理过,否则将进行默认绑定(通常只针对有Text值的控件)</returns>
public void BindingCellData() public void BindingCellData()
{ {
if (DataSource != null)
{
for (int i = 0; i < Columns.Count; i++) for (int i = 0; i < Columns.Count; i++)
{ {
DataGridViewColumnEntity com = Columns[i]; DataGridViewColumnEntity com = Columns[i];
...@@ -166,6 +168,7 @@ namespace HZH_Controls.Controls ...@@ -166,6 +168,7 @@ namespace HZH_Controls.Controls
} }
} }
} }
}
/// <summary> /// <summary>
/// Handles the MouseDown event of the Item control. /// Handles the MouseDown event of the Item control.
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HZH_Controls.Controls
{
public class TransferEventArgs : EventArgs
{
public object[] TransferDataSource { get; set; }
/// <summary>
/// true:right false:left
/// </summary>
/// <value><c>true</c> if [to right or left]; otherwise, <c>false</c>.</value>
public bool ToRightOrLeft { get; set; }
}
public delegate void TransferEventHandler(object sender,TransferEventArgs e);
}
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 2019-10-10
//
// ***********************************************************************
// <copyright file="UCTransfer.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 UCTransfer.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
[DefaultEvent("Transfered")]
public partial class UCTransfer : UserControl
{
/// <summary>
/// 移动数据事件
/// </summary>
[Description("移动数据事件"), Category("自定义")]
public event TransferEventHandler Transfered;
/// <summary>
/// The left columns
/// </summary>
private DataGridViewColumnEntity[] leftColumns;
/// <summary>
/// Gets or sets the left columns.
/// </summary>
/// <value>The left columns.</value>
[Description("左侧列表列"), Category("自定义")]
public DataGridViewColumnEntity[] LeftColumns
{
get { return leftColumns; }
set
{
leftColumns = value;
this.dgvLeft.Columns = leftColumns.ToList();
}
}
/// <summary>
/// The right columns
/// </summary>
private DataGridViewColumnEntity[] rightColumns;
/// <summary>
/// Gets or sets the right columns.
/// </summary>
/// <value>The right columns.</value>
[Description("右侧列表列"), Category("自定义")]
public DataGridViewColumnEntity[] RightColumns
{
get { return rightColumns; }
set
{
rightColumns = value;
this.dgvRight.Columns = leftColumns.ToList();
}
}
/// <summary>
/// The left data source
/// </summary>
private object[] leftDataSource;
/// <summary>
/// 左右列表必须设置相同类型的数据源列表,如果为空必须为长度为0的数组
/// </summary>
/// <value>The left data source.</value>
[Description("左侧列表数据源"), Category("自定义"), Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public object[] LeftDataSource
{
get { return leftDataSource; }
set
{
leftDataSource = value;
dgvLeft.DataSource = value;
}
}
/// <summary>
/// The right data source
/// </summary>
private object[] rightDataSource;
/// <summary>
/// 左右列表必须设置相同类型的数据源列表,如果为空必须为长度为0的数组
/// </summary>
/// <value>The left data source.</value>
[Description("右侧列表数据源"), Category("自定义"), Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public object[] RightDataSource
{
get { return rightDataSource; }
set
{
rightDataSource = value;
dgvRight.DataSource = value;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UCTransfer"/> class.
/// </summary>
public UCTransfer()
{
InitializeComponent();
dgvLeft.IsCloseAutoHeight = true;
dgvRight.IsCloseAutoHeight = true;
LeftColumns = new DataGridViewColumnEntity[0];
RightColumns = new DataGridViewColumnEntity[0];
LeftDataSource = new object[0];
RightDataSource = new object[0];
}
/// <summary>
/// Handles the BtnClick event of the btnRight control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
/// <exception cref="System.Exception">
/// 左右数据源列表不能为空
/// or
/// 左右数据源列表类型不一致,无法进行操作
/// </exception>
private void btnRight_BtnClick(object sender, EventArgs e)
{
if (LeftDataSource == null || RightDataSource == null)
{
throw new Exception("左右数据源列表不能为空");
}
if (LeftDataSource.GetType() != RightDataSource.GetType())
{
throw new Exception("左右数据源列表类型不一致,无法进行操作");
}
if (dgvLeft.SelectRows == null || dgvLeft.SelectRows.Count <= 0)
return;
List<object> lst = new List<object>();
dgvLeft.SelectRows.ForEach(p =>
{
lst.Add(p.DataSource);
p.IsChecked = false;
});
var lstRight = RightDataSource.ToList();
lstRight.AddRange(lst);
var lstLeft = LeftDataSource.ToList();
lstLeft.RemoveAll(p => lst.Contains(p));
RightDataSource = lstRight.ToArray();
LeftDataSource = lstLeft.ToArray();
if (Transfered != null)
{
Transfered(this, new TransferEventArgs() { TransferDataSource = lst.ToArray(), ToRightOrLeft = true });
}
}
/// <summary>
/// Handles the BtnClick event of the btnLeft control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
/// <exception cref="System.Exception">
/// 左右数据源列表不能为空
/// or
/// 左右数据源列表类型不一致,无法进行操作
/// </exception>
private void btnLeft_BtnClick(object sender, EventArgs e)
{
if (LeftDataSource == null || RightDataSource == null)
{
throw new Exception("左右数据源列表不能为空");
}
if (LeftDataSource.GetType() != RightDataSource.GetType())
{
throw new Exception("左右数据源列表类型不一致,无法进行操作");
}
if (dgvRight.SelectRows == null || dgvRight.SelectRows.Count <= 0)
return;
List<object> lst = new List<object>();
dgvRight.SelectRows.ForEach(p =>
{
lst.Add(p.DataSource);
p.IsChecked = false;
});
var lstLeft = LeftDataSource.ToList();
lstLeft.AddRange(lst);
var lstRight = RightDataSource.ToList();
lstRight.RemoveAll(p => lst.Contains(p));
RightDataSource = lstRight.ToArray();
LeftDataSource = lstLeft.ToArray();
if (Transfered != null)
{
Transfered(this, new TransferEventArgs() { TransferDataSource = lst.ToArray(), ToRightOrLeft = false });
}
}
}
}
<?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>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnLeft.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADr0AAA69AUf7kK0AAAB5SURBVFhH7dXBDYAgDAVQlnEBx3IldqHQLZxGKSkkmtQT
GIz/JYT0X34vBAcA8HkhhJWI9ny8RoWVd1VLYoyH3BqbeVf3Epmf8q5Q/r9yYZW8Ui5ygZciLWtv28qH
wBIVlqimWiLfl0/HyodIKW3MvOjYWDkATMS5E+hGfXDhMAVvAAAAAElFTkSuQmCC
</value>
</data>
<data name="btnLeft.ImageFontIcons" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADr0AAA69AUf7kK0AAAB5SURBVFhH7dXBDYAgDAVQlnEBx3IldqHQLZxGKSkkmtQT
GIz/JYT0X34vBAcA8HkhhJWI9ny8RoWVd1VLYoyH3BqbeVf3Epmf8q5Q/r9yYZW8Ui5ygZciLWtv28qH
wBIVlqimWiLfl0/HyodIKW3MvOjYWDkATMS5E+hGfXDhMAVvAAAAAElFTkSuQmCC
</value>
</data>
<data name="btnRight.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADr0AAA69AUf7kK0AAACJSURBVFhH7ZXNCcAgDEZdpgt0rK7UGbqCf1s4TWuKgSLG
U0IRvgcefJenh6gDAIAlyDlvIYRS19nUi+TVSSkdMcab1jcmeRMoMIpJ3gQcgsEhmBq4OEYT0bToVfHe
7zVU2k0LvQkzr0ofof3Mq4L4L3H+dPqI5NXhT6ePSN4Eio1GSvIAgEVw7gENgIbqKKEIVQAAAABJRU5E
rkJggg==
</value>
</data>
<data name="btnRight.ImageFontIcons" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADr0AAA69AUf7kK0AAACJSURBVFhH7ZXNCcAgDEZdpgt0rK7UGbqCf1s4TWuKgSLG
U0IRvgcefJenh6gDAIAlyDlvIYRS19nUi+TVSSkdMcab1jcmeRMoMIpJ3gQcgsEhmBq4OEYT0bToVfHe
7zVU2k0LvQkzr0ofof3Mq4L4L3H+dPqI5NXhT6ePSN4Eio1GSvIAgEVw7gENgIbqKKEIVQAAAABJRU5E
rkJggg==
</value>
</data>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -113,6 +113,13 @@ ...@@ -113,6 +113,13 @@
<Compile Include="Controls\TimeLine\UCTimeLine.Designer.cs"> <Compile Include="Controls\TimeLine\UCTimeLine.Designer.cs">
<DependentUpon>UCTimeLine.cs</DependentUpon> <DependentUpon>UCTimeLine.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Controls\Transfer\TransferEventArgs.cs" />
<Compile Include="Controls\Transfer\UCTransfer.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\Transfer\UCTransfer.Designer.cs">
<DependentUpon>UCTransfer.cs</DependentUpon>
</Compile>
<Compile Include="Controls\Verification\VerificationAttribute.cs" /> <Compile Include="Controls\Verification\VerificationAttribute.cs" />
<Compile Include="Controls\Verification\VerificationComponent.cs"> <Compile Include="Controls\Verification\VerificationComponent.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
...@@ -762,6 +769,9 @@ ...@@ -762,6 +769,9 @@
<EmbeddedResource Include="Controls\TimeLine\UCTimeLine.resx"> <EmbeddedResource Include="Controls\TimeLine\UCTimeLine.resx">
<DependentUpon>UCTimeLine.cs</DependentUpon> <DependentUpon>UCTimeLine.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Controls\Transfer\UCTransfer.resx">
<DependentUpon>UCTransfer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\UCControlBase.resx"> <EmbeddedResource Include="Controls\UCControlBase.resx">
<DependentUpon>UCControlBase.cs</DependentUpon> <DependentUpon>UCControlBase.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -67,6 +67,7 @@ namespace Test ...@@ -67,6 +67,7 @@ namespace Test
tnControl.Nodes.Add("导航菜单"); tnControl.Nodes.Add("导航菜单");
tnControl.Nodes.Add("分割线标签"); tnControl.Nodes.Add("分割线标签");
tnControl.Nodes.Add("时间轴"); tnControl.Nodes.Add("时间轴");
tnControl.Nodes.Add("穿梭框");
this.tvMenu.Nodes.Add(tnControl); this.tvMenu.Nodes.Add(tnControl);
TreeNode tnCharts = new TreeNode(" 图表"); TreeNode tnCharts = new TreeNode(" 图表");
...@@ -258,7 +259,7 @@ namespace Test ...@@ -258,7 +259,7 @@ namespace Test
AddControl(new UC.UCTestVerification() { Dock = DockStyle.Fill }); AddControl(new UC.UCTestVerification() { Dock = DockStyle.Fill });
break; break;
case "图片采样控件": case "图片采样控件":
AddControl(new UC.UCTestSampling() ); AddControl(new UC.UCTestSampling());
break; break;
case "倒影": case "倒影":
AddControl(new UC.UCTestShadow()); AddControl(new UC.UCTestShadow());
...@@ -275,6 +276,9 @@ namespace Test ...@@ -275,6 +276,9 @@ namespace Test
case "时间轴": case "时间轴":
AddControl(new UC.UCTestTimeLine() { Dock = DockStyle.Fill }); AddControl(new UC.UCTestTimeLine() { Dock = DockStyle.Fill });
break; break;
case "穿梭框":
AddControl(new UC.UCTestTransfer());
break;
#endregion #endregion
#region 图表 English:Chart #region 图表 English:Chart
......
...@@ -320,6 +320,12 @@ ...@@ -320,6 +320,12 @@
<Compile Include="UC\UCTestTrackbar.Designer.cs"> <Compile Include="UC\UCTestTrackbar.Designer.cs">
<DependentUpon>UCTestTrackbar.cs</DependentUpon> <DependentUpon>UCTestTrackbar.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UC\UCTestTransfer.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UC\UCTestTransfer.Designer.cs">
<DependentUpon>UCTestTransfer.cs</DependentUpon>
</Compile>
<Compile Include="UC\UCTestTreeGridTable.cs"> <Compile Include="UC\UCTestTreeGridTable.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -500,6 +506,9 @@ ...@@ -500,6 +506,9 @@
<EmbeddedResource Include="UC\UCTestTrackbar.resx"> <EmbeddedResource Include="UC\UCTestTrackbar.resx">
<DependentUpon>UCTestTrackbar.cs</DependentUpon> <DependentUpon>UCTestTrackbar.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UC\UCTestTransfer.resx">
<DependentUpon>UCTestTransfer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UC\UCTestTreeGridTable.resx"> <EmbeddedResource Include="UC\UCTestTreeGridTable.resx">
<DependentUpon>UCTestTreeGridTable.cs</DependentUpon> <DependentUpon>UCTestTreeGridTable.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
namespace Test.UC
{
partial class UCTestTransfer
{
/// <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.ucTransfer1 = new HZH_Controls.Controls.UCTransfer();
this.SuspendLayout();
//
// ucTransfer1
//
this.ucTransfer1.BackColor = System.Drawing.Color.White;
this.ucTransfer1.LeftColumns = new HZH_Controls.Controls.DataGridViewColumnEntity[0];
this.ucTransfer1.LeftDataSource = new object[0];
this.ucTransfer1.Location = new System.Drawing.Point(22, 22);
this.ucTransfer1.Name = "ucTransfer1";
this.ucTransfer1.RightDataSource = new object[0];
this.ucTransfer1.Size = new System.Drawing.Size(451, 397);
this.ucTransfer1.TabIndex = 0;
//
// UCTestTransfer
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.ucTransfer1);
this.Name = "UCTestTransfer";
this.Size = new System.Drawing.Size(619, 573);
this.Load += new System.EventHandler(this.UCTestTransfer_Load);
this.ResumeLayout(false);
}
#endregion
private HZH_Controls.Controls.UCTransfer ucTransfer1;
}
}
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;
using HZH_Controls.Controls;
namespace Test.UC
{
[ToolboxItem(false)]
public partial class UCTestTransfer : UserControl
{
public UCTestTransfer()
{
InitializeComponent();
}
private void UCTestTransfer_Load(object sender, EventArgs e)
{
DataGridViewColumnEntity[] lstLeftCulumns = new DataGridViewColumnEntity[1];
lstLeftCulumns[0] = new DataGridViewColumnEntity() { DataField = "Value", HeadText = "列表一", TextAlign= ContentAlignment.MiddleLeft };
DataGridViewColumnEntity[] lstRightCulumns = new DataGridViewColumnEntity[1];
lstRightCulumns[0] = new DataGridViewColumnEntity() { DataField = "Value", HeadText = "列表二", TextAlign = ContentAlignment.MiddleLeft };
this.ucTransfer1.LeftColumns = lstLeftCulumns;
this.ucTransfer1.RightColumns = lstRightCulumns;
var lstItems = new TestModel[5];
for (int i = 0; i < 5; i++)
{
lstItems[i] = new TestModel() { Key = i, Value = "选择项" + i };
}
this.ucTransfer1.LeftDataSource = lstItems;
this.ucTransfer1.RightDataSource = new TestModel[0];
}
private class TestModel
{
public int Key { get; set; }
public string Value { get; set; }
}
}
}
<?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
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!