Esempio n. 1
0
        /// <summary>
        /// 为节点提供Tooltip
        /// 说明:
        /// 1.设置tree.ToolTipController属性
        /// 2.ToolTipController的GetActiveObjectInfo事件中使用
        /// 3.举例
        /// tlLHData.CustomNodeTooltip(e, node =>
        ///{
        ///    string _cabId = node.GetKeyID();
        ///    CCabInfo _cabinfo = LHDBHelper.GetCabInfo(_cabId);
        ///    if (_cabinfo != null)
        ///    {
        ///        return string.Format("核对时间:{0}\r\n在线情况:{1}\r\n最后一次活跃时间:{2}\r\n",
        ///                              _cabinfo.ChkDataTime,
        ///                              _cabinfo.CtuOnlineStatus == 1 ? "在线" : "未上线",
        ///                              _cabinfo.LastAliveTime);
        ///    }
        ///    return string.Empty;
        ///});
        /// </summary>
        /// <param name="tree">TreeList</param>
        /// <param name="e">ToolTipControllerGetActiveObjectInfoEventArgs</param>
        /// <param name="builderNodeTooltipFactory">委托</param>
        public static void CustomNodeTooltip(this TreeList tree, ToolTipControllerGetActiveObjectInfoEventArgs e, Func <TreeListNode, string> builderNodeTooltipFactory)
        {
            if (e.SelectedControl is DevExpress.XtraTreeList.TreeList)
            {
                TreeList        _tree = (TreeList)e.SelectedControl;
                TreeListHitInfo _hit  = _tree.CalcHitInfo(e.ControlMousePosition);

                if (_hit.HitInfoType == HitInfoType.Cell)
                {
                    TreeListViewInfo _viewInfo    = _tree.ViewInfo;
                    RowInfo          _rowInfo     = _viewInfo.GetRowInfoByPoint(e.ControlMousePosition);
                    CellInfo         _cellInfo    = _rowInfo.Cells[_hit.Column.VisibleIndex] as CellInfo;
                    EditHitInfo      _editHitInfo = _cellInfo.EditorViewInfo.CalcHitInfo(e.ControlMousePosition);

                    if (_editHitInfo.HitTest == EditHitTest.MaskBox)
                    {
                        string _toolTip = builderNodeTooltipFactory(_hit.Node);

                        if (!string.IsNullOrEmpty(_toolTip))
                        {
                            e.Info = new ToolTipControlInfo(_cellInfo, _toolTip);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 private void CalcGroupLevelIndentRects(TreeListViewInfo viewInfo, TreeListNode currentNode, Rectangle bounds,
                                        Dictionary <int, Rectangle> rects)
 {
     if (currentNode == null)
     {
         return;
     }
     if (currentNode.HasChildren)
     {
         rects.Add(currentNode.Level, new Rectangle(bounds.Right - viewInfo.RC.LevelWidth, bounds.Y, viewInfo.RC.LevelWidth, bounds.Height));
     }
     bounds = new Rectangle(bounds.Location, new Size(bounds.Width - viewInfo.RC.LevelWidth, bounds.Height));
     CalcGroupLevelIndentRects(viewInfo, currentNode.ParentNode, bounds, rects);
 }
Esempio n. 3
0
 public MyTreeListOperationPrintEachNode(TreeList treeList, TreeListPrinter printer, TreeListViewInfo viewInfo, bool printTree, bool printImages, bool printCheckBoxes, bool printAllNodes)
     : base(treeList, printer, viewInfo, printTree, printImages, printCheckBoxes)
 {
     this.treeList      = treeList;
     this.printAllNodes = printAllNodes;
 }