SVN-Revision: r394
This commit is contained in:
tdx
2025-03-26 01:17:51 +00:00
parent 04a703c2fd
commit 6351f33c68
@@ -79,7 +79,9 @@ namespace Lskj.Control
public TreeBandedGridControlEx()
{
InitializeComponent();
this.gcMain.IndicatorWidth = 40;
this.gcMain.KeyDown += new KeyEventHandler(OnTreeGridViewKeyDown);
this.gcMain.CustomDrawNodeIndicator += TreeListObj_CustomDrawNodeIndicator;//显示行号
this.gcMain.SelectionChanged += new EventHandler(gcMain_SelectionChanged);
this.gcMain.CustomDrawNodeCell += new CustomDrawNodeCellEventHandler(OnCustomDrawNodeCell);
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
@@ -90,6 +92,22 @@ namespace Lskj.Control
//this.gcMain.OptionsBehavior.EnableFiltering = 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)
{
//try
@@ -1896,11 +1914,18 @@ namespace Lskj.Control
public override void SetGridViewDataSource(DataTable table, bool selectRowHandler = true)
{
TreeListNode lastNode = this.TreeListObj.FocusedNode;
GetTreeExpanded();
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)
{