Ejemplo n.º 1
0
 protected void DrawRowSelectRect(Graphics g, Rectangle rcFocus, bool dropTargetRow, bool focusRow)
 {
     if (_fullRowSelect)
     {
         if (dropTargetRow)
         {
             JetListViewColumn.DrawDropTarget(g, rcFocus);
         }
         else if (focusRow)
         {
             _controlPainter.DrawFocusRect(g, rcFocus);
         }
     }
 }
Ejemplo n.º 2
0
        public void DrawRow(Graphics g, Rectangle rc, JetListViewNode itemNode, RowState rowState)
        {
            bool focusRow      = false;
            bool dropTargetRow = false;

            if ((rowState & RowState.Focused) != 0 && _baseRowRenderer.SearchHighlightText != null &&
                _baseRowRenderer.SearchHighlightText.Length > 0)
            {
                rowState |= RowState.IncSearchMatch;
            }

            if (_baseRowRenderer.FullRowSelect)
            {
                focusRow      = ((rowState & RowState.Focused) != 0);
                dropTargetRow = ((rowState & RowState.DropTarget) != 0);
                rowState     &= ~(RowState.Focused | RowState.DropTarget);
            }

            int       baseHeight = _baseRowRenderer.GetRowHeight(itemNode);
            Rectangle rcBase     = new Rectangle(rc.Left, rc.Top, rc.Width, baseHeight);

            _baseRowRenderer.DrawRow(g, rcBase, itemNode, rowState);
            int indent       = _baseRowRenderer.GetAutoPreviewIndent(itemNode);
            int previewWidth = _baseRowRenderer.ScrollRange - _baseRowRenderer.ScrollOffset;

            if (previewWidth == 0)
            {
                previewWidth = _baseRowRenderer.VisibleWidth;
            }

            Rectangle rcPreview = new Rectangle(indent, rc.Top + baseHeight,
                                                previewWidth + _baseRowRenderer.BorderSize - indent, rc.Height - baseHeight);
            Rectangle rcFocus = _baseRowRenderer.GetFocusRect(itemNode, rc);

            if (rcPreview.Height > 0)
            {
                if (_baseRowRenderer.FullRowSelect)
                {
                    if ((rowState & RowState.IncSearchMatch) != 0 &&
                        ((rowState & RowState.ActiveSelected) != 0))
                    {
                        rowState &= ~RowState.ActiveSelected;
                        rowState |= RowState.InactiveSelected;
                    }
                }
                // in multiline view, the rectangle which must be painted with the auto-preview
                // background color is wider than the rectangle containing the column text
                Rectangle rcPreviewBackground = new Rectangle(rcFocus.Left, rcPreview.Top, rcFocus.Width, rcPreview.Height);
                _previewColumn.DrawItemBackground(g, rcPreviewBackground, rcPreviewBackground, itemNode, rowState, null);
                _previewColumn.DrawNode(g, rcPreview, itemNode, rowState, null);
            }

            if (dropTargetRow || focusRow)
            {
                if (dropTargetRow)
                {
                    JetListViewColumn.DrawDropTarget(g, rcFocus);
                }
                else if (focusRow)
                {
                    _baseRowRenderer.ControlPainter.DrawFocusRect(g, rcFocus);
                }
            }
        }