コード例 #1
0
        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);
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        public TreeViewAdv()
        {
            this.BackColor = SystemColors.Window;
            SetStyle(ControlStyles.AllPaintingInWmPaint
                     | ControlStyles.UserPaint
                     | ControlStyles.OptimizedDoubleBuffer
                     | ControlStyles.ResizeRedraw
                     | ControlStyles.Selectable
                     , true);

            _rowLayout         = new AutoRowHeightLayout(this, 0);
            _rowMap            = new List <TreeNodeAdv>();
            _selection         = new List <TreeNodeAdv>();
            _readonlySelection = new ReadOnlyCollection <TreeNodeAdv>(_selection);
            _columns           = new TreeColumnCollection(this);
            _toolTip           = new ToolTip {
                ShowAlways = true
            };

            //_measureContext = new DrawContext();
            //_measureContext.Font = Font; //au: will set in OnFontChanged
            //_measureContext.Graphics = Graphics.FromImage(new Bitmap(1, 1));
            _measureContext.Graphics = Graphics.FromHwndInternal(default);             //au