Exemple #1
0
        void SetHotColumn(TreeListColumn col, bool ishot)
        {
            int scrolloffset = HScrollValue();

            if (col != m_hotColumn)
            {
                if (m_hotColumn != null)
                {
                    m_hotColumn.ishot = false;
                    Rectangle r = m_hotColumn.CalculatedRect;
                    r.X -= scrolloffset;
                    Invalidate(r);
                }
                m_hotColumn = col;
                if (m_hotColumn != null)
                {
                    m_hotColumn.ishot = ishot;
                    Rectangle r = m_hotColumn.CalculatedRect;
                    r.X -= scrolloffset;
                    Invalidate(r);
                }
            }
        }
Exemple #2
0
        protected virtual Rectangle GetPlusMinusRectangle(Node node, TreeListColumn firstColumn, int visibleRowIndex)
        {
            if (node.HasChildren == false)
            {
                return(Rectangle.Empty);
            }
            int hScrollOffset = HScrollValue();

            if (firstColumn.CalculatedRect.Right - hScrollOffset < RowHeaderWidth())
            {
                return(Rectangle.Empty);
            }
            System.Diagnostics.Debug.Assert(firstColumn.VisibleIndex == 0);

            Rectangle glyphRect = firstColumn.CalculatedRect;

            glyphRect.X     -= hScrollOffset;
            glyphRect.X     += GetIndentSize(node);
            glyphRect.X     += Columns.Options.LeftMargin;
            glyphRect.Width  = 10;
            glyphRect.Y      = VisibleRowToYPoint(visibleRowIndex);
            glyphRect.Height = RowOptions.ItemHeight;
            return(glyphRect);
        }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            this.Focus();
            if (e.Button == MouseButtons.Right)
            {
                Point mousePoint  = new Point(e.X, e.Y);
                Node  clickedNode = CalcHitNode(mousePoint);
                if (clickedNode != null)
                {
                    // if multi select the selection is cleard if clicked node is not in selection
                    if (MultiSelect)
                    {
                        if (NodesSelection.Contains(clickedNode) == false)
                        {
                            MultiSelectAdd(clickedNode, Control.ModifierKeys);
                        }
                    }

                    FocusedNode = clickedNode;
                    Invalidate();
                }
                BeforeShowContextMenu();
            }

            if (e.Button == MouseButtons.Left)
            {
                CommonTools.HitInfo info = Columns.CalcHitInfo(new Point(e.X, e.Y), HScrollValue());
                if ((int)(info.HitType & HitInfo.eHitType.kColumnHeaderResize) > 0)
                {
                    m_resizingColumn             = info.Column;
                    m_resizingColumnScrollOffset = HScrollValue();
                    return;
                }
            }
            base.OnMouseDown(e);
        }
 protected virtual TreeList.TextFormatting GetFormatting(Node node, TreeListColumn column)
 {
     return(column.CellFormat);
 }