public TreeViewAdv() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.Selectable , true); if (Application.RenderWithVisualStyles) { _columnHeaderHeight = 20; } else { _columnHeaderHeight = 17; } //BorderStyle = BorderStyle.Fixed3D; _hScrollBar.Height = SystemInformation.HorizontalScrollBarHeight; _vScrollBar.Width = SystemInformation.VerticalScrollBarWidth; _rowLayout = new FixedRowHeightLayout(this, RowHeight); _rowMap = new List <TreeNodeAdv>(); _selection = new List <TreeNodeAdv>(); _readonlySelection = new ReadOnlyCollection <TreeNodeAdv>(_selection); _columns = new TreeColumnCollection(this); _toolTip = new ToolTip(); _dragTimer = new System.Windows.Forms.Timer(); _dragTimer.Interval = 100; _dragTimer.Tick += new EventHandler(DragTimerTick); _measureContext = new DrawContext(); _measureContext.Font = Font; _measureContext.Graphics = Graphics.FromImage(new Bitmap(1, 1)); Input = new NormalInputState(this); _search = new IncrementalSearch(this); CreateNodes(); CreatePens(); ArrangeControls(); _plusMinus = new NodePlusMinus(); _controls = new NodeControlsCollection(this); Font = _font; // !!!Modified by [email protected] //ExpandingIcon.IconChanged += new EventHandler(ExpandingIconChanged); }
public TreeViewAdv() { InitializeComponent(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.Selectable | ControlStyles.CacheText, true); if (OSVersion.IsBelow(WindowsVersion.Vista)) { this.ColumnHeaderHeight = ExplorerVisualStyle.VisualStylesEnabled ? 20 : 17; } else { this.ColumnHeaderHeight = ExplorerVisualStyle.VisualStylesEnabled ? 25 : 17; } //BorderStyle = BorderStyle.Fixed3D; _hScrollBar.Height = SystemInformation.HorizontalScrollBarHeight; _vScrollBar.Width = SystemInformation.VerticalScrollBarWidth; _rowLayout = new FixedRowHeightLayout(this, RowHeight); this.RowMap = new List <TreeNodeAdv>(); this.Selection = new List <TreeNodeAdv>(); this.SelectedNodes = new ReadOnlyCollection <TreeNodeAdv>(this.Selection); this.Columns = new TreeColumnCollection(this); _toolTip = new ToolTip(); _measureContext = new DrawContext { Font = this.Font, Graphics = Graphics.FromImage(new Bitmap(1, 1)) }; this.Input = new NormalInputState(this); _search = new IncrementalSearch(this); CreateNodes(); CreatePens(); ArrangeControls(); _plusMinus = new NodePlusMinus(this); this.NodeControls = new NodeControlsCollection(this); Font = _font; }
/// <summary> /// Calculates coordinats for PlusMinus button of this node and all child nodes. /// </summary> /// <param name="plusMinusCalc"></param> /// <param name="needRootPlusMinus"></param> internal void CalculatePlusMinus(Func <CTreeNode, Point> plusMinusCalc, bool needRootPlusMinus) { if (Visible && Nodes.Count > 0) { if (needRootPlusMinus) { Point locationPlusMinus = plusMinusCalc(this); locationPlusMinus.Offset(-OwnerCTreeView.PlusMinus.Size.Width / 2, -OwnerCTreeView.PlusMinus.Size.Width / 2); PlusMinus = new NodePlusMinus(new Rectangle(locationPlusMinus, OwnerCTreeView.PlusMinus.Size)); } else { PlusMinus = null; } foreach (CTreeNode child in Nodes) { child.CalculatePlusMinus(plusMinusCalc, true); } } }
public TreeViewAdv() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.Selectable , true); _headerLayout = new FixedHeaderHeightLayout(this, Application.RenderWithVisualStyles ? 20: 17); //BorderStyle = BorderStyle.Fixed3D; _hScrollBar.Height = SystemInformation.HorizontalScrollBarHeight; _vScrollBar.Width = SystemInformation.VerticalScrollBarWidth; _rowLayout = new FixedRowHeightLayout(this, RowHeight); _rowMap = new List <TreeNodeAdv>(); _selection = new List <TreeNodeAdv>(); _readonlySelection = new ReadOnlyCollection <TreeNodeAdv>(_selection); _columns = new TreeColumnCollection(this); _toolTip = new ToolTip(); _measureContext = new DrawContext(); _measureContext.Font = Font; _measureContext.Graphics = Graphics.FromImage(new Bitmap(1, 1)); Input = new NormalInputState(this); _search = new IncrementalSearch(this); CreateNodes(); CreatePens(); ArrangeControls(); _plusMinus = new NodePlusMinus(); _controls = new NodeControlsCollection(this); Font = _font; ExpandingIcon.IconChanged += ExpandingIconChanged; }