SVN r394
SVN-Revision: r394
This commit is contained in:
@@ -79,7 +79,9 @@ namespace Lskj.Control
|
|||||||
public TreeBandedGridControlEx()
|
public TreeBandedGridControlEx()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.gcMain.IndicatorWidth = 40;
|
||||||
this.gcMain.KeyDown += new KeyEventHandler(OnTreeGridViewKeyDown);
|
this.gcMain.KeyDown += new KeyEventHandler(OnTreeGridViewKeyDown);
|
||||||
|
this.gcMain.CustomDrawNodeIndicator += TreeListObj_CustomDrawNodeIndicator;//显示行号
|
||||||
this.gcMain.SelectionChanged += new EventHandler(gcMain_SelectionChanged);
|
this.gcMain.SelectionChanged += new EventHandler(gcMain_SelectionChanged);
|
||||||
this.gcMain.CustomDrawNodeCell += new CustomDrawNodeCellEventHandler(OnCustomDrawNodeCell);
|
this.gcMain.CustomDrawNodeCell += new CustomDrawNodeCellEventHandler(OnCustomDrawNodeCell);
|
||||||
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
|
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
|
||||||
@@ -90,6 +92,22 @@ namespace Lskj.Control
|
|||||||
//this.gcMain.OptionsBehavior.EnableFiltering = true;
|
//this.gcMain.OptionsBehavior.EnableFiltering = true;
|
||||||
//this.gcMain.OptionsFind.AlwaysVisible = true;
|
//this.gcMain.OptionsFind.AlwaysVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TreeListObj_CustomDrawNodeIndicator(object sender, CustomDrawNodeIndicatorEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TreeList tree = sender as DevExpress.XtraTreeList.TreeList;
|
||||||
|
DevExpress.Utils.Drawing.IndicatorObjectInfoArgs args = e.ObjectArgs as DevExpress.Utils.Drawing.IndicatorObjectInfoArgs;
|
||||||
|
args.DisplayText = (tree.GetVisibleIndexByNode(e.Node) + 1).ToString();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void gcMain_SelectionChanged(object sender, EventArgs e)
|
void gcMain_SelectionChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//try
|
//try
|
||||||
@@ -1896,11 +1914,18 @@ namespace Lskj.Control
|
|||||||
public override void SetGridViewDataSource(DataTable table, bool selectRowHandler = true)
|
public override void SetGridViewDataSource(DataTable table, bool selectRowHandler = true)
|
||||||
{
|
{
|
||||||
TreeListNode lastNode = this.TreeListObj.FocusedNode;
|
TreeListNode lastNode = this.TreeListObj.FocusedNode;
|
||||||
|
GetTreeExpanded();
|
||||||
this.gcMain.DataSource = table;
|
this.gcMain.DataSource = table;
|
||||||
if (selectRowHandler)
|
//根据记录展开对应节点
|
||||||
|
foreach (TreeListNode treeListNode in treeListNodes)
|
||||||
{
|
{
|
||||||
this.TreeListObj.FocusedNode = lastNode;
|
TreeListNode treeListNode1 = this.gcMain.Nodes.TreeList.FindNodeByID(treeListNode.Id);
|
||||||
|
if (treeListNode1 != null) treeListNode1.Expanded = true;
|
||||||
}
|
}
|
||||||
|
//if (selectRowHandler)
|
||||||
|
//{
|
||||||
|
// this.TreeListObj.FocusedNode = lastNode;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
public override int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
|
public override int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user