Exemple #1
0
 public ContextMenuRequestEventArgs(CustomListBoxColumn column, int columnIndex, int x, int y)
 {
     _column      = column;
     _columnIndex = columnIndex;
     _x           = x;
     _y           = y;
 }
 public ContextMenuRequestEventArgs(CustomListBoxColumn column, int columnIndex, int x, int y)
 {
     _column = column;
     _columnIndex = columnIndex;
     _x = x;
     _y = y;
 }
        public override void OnPaintColumnContent(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
        {
            var graphics = paintEventArgs.Graphics;
            var rect = paintEventArgs.Bounds;
            var font = column.HeaderFont;

            ItemPaintEventArgs.PrepareContentRectangle(ref rect);
            paintEventArgs.PrepareTextRectangle(font, font, ref rect);
            if(column.Extender != null && ((paintEventArgs.State & (ItemState.Hovered | ItemState.Pressed)) != ItemState.None))
            {
                rect.Width -= CustomListBoxColumn.ExtenderButtonWidth;
                if(rect.Width <= 0) return;
            }
            StringFormat format;
            switch(column.HeaderAlignment)
            {
                case StringAlignment.Near:
                    format = GitterApplication.TextRenderer.LeftAlign;
                    break;
                case StringAlignment.Far:
                    format = GitterApplication.TextRenderer.RightAlign;
                    break;
                case StringAlignment.Center:
                    format = GitterApplication.TextRenderer.CenterAlign;
                    break;
                default:
                    format = GitterApplication.TextRenderer.LeftAlign;
                    break;
            }
            GitterApplication.TextRenderer.DrawText(graphics, column.Name, font, column.HeaderBrush, rect, format);
        }
Exemple #4
0
        private ColumnResizeProcess(CustomListBoxColumn resizingColumn, int deltaSign, Point mouseDownLocation)
        {
            Assert.IsNotNull(resizingColumn);

            _mouseDownLocation = mouseDownLocation;
            _resizingColumn    = resizingColumn;
            _initialWidth      = resizingColumn.Width;
            _deltaSign         = deltaSign;
        }
 /// <summary>Create <see cref="ItemPaintEventArgs"/>.</summary>
 /// <param name="graphics">Graphics surface to draw the item on.</param>
 /// <param name="clipRectangle">Clipping rectangle.</param>
 /// <param name="bounds">Rectangle that represents the bounds of the item that is being drawn.</param>
 /// <param name="index">Index value of the item that is being drawn.</param>
 /// <param name="state">State of the item being drawn.</param>
 /// <param name="hoveredPart">Hovered part of the item.</param>
 /// <param name="hostControlFocused">Host control is focused.</param>
 public SubItemPaintEventArgs(
     Graphics graphics, Rectangle clipRectangle, Rectangle bounds, int index,
     ItemState state, int hoveredPart, bool hostControlFocused,
     int columnIndex, CustomListBoxColumn column)
     : base(graphics, clipRectangle, bounds, index, state, hoveredPart, hostControlFocused)
 {
     _columnIndex = columnIndex;
     _column      = column;
 }
Exemple #6
0
 /// <summary>Create <see cref="ItemPaintEventArgs"/>.</summary>
 /// <param name="graphics">Graphics surface to draw the item on.</param>
 /// <param name="clipRectangle">Clipping rectangle.</param>
 /// <param name="bounds">Rectangle that represents the bounds of the item that is being drawn.</param>
 /// <param name="index">Index value of the item that is being drawn.</param>
 /// <param name="state">State of the item being drawn.</param>
 /// <param name="hoveredPart">Hovered part of the item.</param>
 /// <param name="hostControlFocused">Host control is focused.</param>
 public SubItemPaintEventArgs(
     Graphics graphics, Rectangle clipRectangle, Rectangle bounds, int index,
     ItemState state, int hoveredPart, bool hostControlFocused,
     int columnIndex, CustomListBoxColumn column)
     : base(graphics, clipRectangle, bounds, index, state, hoveredPart, hostControlFocused)
 {
     _columnIndex = columnIndex;
     _column = column;
 }
Exemple #7
0
        private ColumnResizeProcess(CustomListBoxColumn resizingColumn, int deltaSign, Point mouseDownLocation)
        {
            Assert.IsNotNull(resizingColumn);

            _mouseDownLocation = mouseDownLocation;
            _resizingColumn    = resizingColumn;
            _initialWidth      = resizingColumn.Width;
            _deltaSign         = deltaSign;
        }
Exemple #8
0
 public UsresListBox()
 {
     Columns.AddRange(
         new[]
         {
             _colName		= new NameColumn(Resources.StrName),
             _colEmail		= new EmailColumn(),
             _colCommits		= new CustomListBoxColumn((int)ColumnId.Commits, Resources.StrCommits) { Width = 80 },
         });
 }
Exemple #9
0
 public ReferencesListBox()
 {
     Columns.AddRange(new[]
         {
             _colName = new NameColumn(),
             _colHash = new HashColumn(),
             _colTreeHash = new TreeHashColumn(),
         });
     ShowTreeLines = true;
 }
        /// <summary>Create <see cref="RepositoryExplorerListBox"/>.</summary>
        public RepositoryExplorerListBox()
        {
            _nameColumn = new CustomListBoxColumn(0, Resources.StrName)
            {
                SizeMode = ColumnSizeMode.Auto
            };
            Columns.Add(_nameColumn);

            ShowTreeLines = true;
            HeaderStyle = HeaderStyle.Hidden;
            ShowRootTreeLines = false;
        }
Exemple #11
0
        private static void RenderColumnPressedBackground(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
        {
            var graphics = paintEventArgs.Graphics;
            var rect     = paintEventArgs.Bounds;
            var c1       = Color.FromArgb(192, 203, 217);
            var c2       = Color.FromArgb(246, 247, 248);
            var c3       = Color.FromArgb(193, 204, 218);
            var c4       = Color.FromArgb(215, 222, 231);
            var c5       = Color.FromArgb(235, 238, 242);

            using (var p = new Pen(c1))
            {
                var rc = rect;
                rc.Y     -= 1;
                rc.X     += 1;
                rc.Width -= 2;
                graphics.DrawRectangle(p, rc);
            }
            using (var b = new SolidBrush(c2))
            {
                var rc = rect;
                rc.Y      += 3;
                rc.X      += 2;
                rc.Width  -= 4;
                rc.Height -= 4;
                graphics.FillRectangle(b, rc);
            }
            using (var p = new Pen(c3))
            {
                var rc = rect;
                graphics.DrawLine(p, rc.X + 1, rc.Y + 0, rc.Right - 2, rc.Y + 0);
            }
            using (var p = new Pen(c4))
            {
                var rc = rect;
                graphics.DrawLine(p, rc.X + 1, rc.Y + 1, rc.Right - 2, rc.Y + 1);
            }
            using (var p = new Pen(c5))
            {
                var rc = rect;
                graphics.DrawLine(p, rc.X + 1, rc.Y + 2, rc.Right - 2, rc.Y + 2);
            }
            if (column.Extender != null)
            {
                if (rect.Width > CustomListBoxColumn.ExtenderButtonWidth)
                {
                    graphics.FillRectangle(ExtenderBorderBrush, rect.Right - CustomListBoxColumn.ExtenderButtonWidth - 0.5f, rect.Y, 1, rect.Height - 1);
                    graphics.DrawImage(ImgColumnExtender, rect.Right - CustomListBoxColumn.ExtenderButtonWidth + 4, rect.Y + 9, 7, 4);
                }
            }
        }
Exemple #12
0
        protected virtual void OnPaintItem(TItem item, DrawItemEventArgs e)
        {
            Assert.IsNotNull(item);
            Assert.IsNotNull(e);

            var  itemState  = ItemState.None;
            bool isSelected = false;

            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                itemState |= ItemState.Selected;
                isSelected = true;
            }
            if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)
            {
                itemState |= ItemState.Focused;
            }

            if (isSelected)
            {
                var column = new CustomListBoxColumn(0, string.Empty);
                using (var brush = new SolidBrush(e.ForeColor))
                {
                    column.ContentBrush = brush;
                    var args = new SubItemPaintEventArgs(e.Graphics,
                                                         e.Bounds,
                                                         e.Bounds,
                                                         0,
                                                         itemState,
                                                         0,
                                                         Focused,
                                                         0,
                                                         column);
                    item.PaintSubItem(args);
                }
            }
            else
            {
                var args = new SubItemPaintEventArgs(e.Graphics,
                                                     e.Bounds,
                                                     e.Bounds,
                                                     0,
                                                     itemState,
                                                     0,
                                                     Focused,
                                                     0,
                                                     DropDownControl.Columns[0]);
                item.PaintSubItem(args);
            }
        }
 public override void OnPaintColumnBackground(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
 {
     switch(paintEventArgs.State)
     {
         case ItemState.None:
             RenderColumnNormalBackground(paintEventArgs);
             break;
         case ItemState.Pressed:
             RenderColumnPressedBackground(column, paintEventArgs);
             break;
         default:
             RenderColumnHoverBackground(column, paintEventArgs);
             break;
     }
 }
Exemple #14
0
        private static void RenderColumnHoverBackground(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
        {
            var graphics = paintEventArgs.Graphics;
            var rect     = paintEventArgs.Bounds;
            var c1       = Color.FromArgb(227, 232, 238);
            var c2       = Color.FromArgb(241, 245, 251);

            using (var p = new Pen(c1))
            {
                var rc = rect;
                rc.Y     -= 1;
                rc.Width -= 1;
                graphics.DrawRectangle(p, rc);
            }
            using (var b = new SolidBrush(c2))
            {
                var rc = rect;
                rc.X      += 2;
                rc.Y      += 1;
                rc.Width  -= 4;
                rc.Height -= 3;
                graphics.FillRectangle(b, rc);
            }
            if (column.Extender != null)
            {
                if (rect.Width > CustomListBoxColumn.ExtenderButtonWidth)
                {
                    if (paintEventArgs.HoveredPart == ColumnHitTestResults.Extender)
                    {
                        graphics.FillRectangle(ExtenderHoveredBrush,
                                               rect.Right - CustomListBoxColumn.ExtenderButtonWidth + 1.5f, rect.Y + 1.5f,
                                               CustomListBoxColumn.ExtenderButtonWidth - 4, rect.Height - 4);
                        graphics.DrawRectangle(ExtenderBorderPenHovered,
                                               rect.Right - CustomListBoxColumn.ExtenderButtonWidth, 0,
                                               CustomListBoxColumn.ExtenderButtonWidth - 1, rect.Height - 1);
                    }
                    else
                    {
                        graphics.FillRectangle(ExtenderBorderBrush,
                                               rect.Right - CustomListBoxColumn.ExtenderButtonWidth - 0.5f, rect.Y,
                                               1, rect.Height);
                    }
                    graphics.DrawImage(ImgColumnExtender,
                                       rect.Right - CustomListBoxColumn.ExtenderButtonWidth + 4, rect.Y + 9,
                                       7, 4);
                }
            }
        }
Exemple #15
0
 public ReflogListBox()
 {
     Columns.AddRange(new[]
         {
             _colHash			= new HashColumn()				{ IsVisible = true, Abbreviate = true, Width = 58 },
             _colTreeHash		= new TreeHashColumn()			{ IsVisible = false, Abbreviate = true, Width = 58 },
             _colCommitDate		= new CommitDateColumn()		{ IsVisible = false },
             _colMessage			= new MessageColumn()			{ IsVisible = true },
             _colSubject			= new SubjectColumn()			{ IsVisible = false },
             _colCommitter		= new CommitterColumn()			{ IsVisible = false },
             _colCommitterEmail	= new CommitterEmailColumn()	{ IsVisible = false },
             _colAuthorDate		= new AuthorDateColumn()		{ IsVisible = false },
             _colAuthor			= new AuthorColumn()			{ IsVisible = false },
             _colAuthorEmail		= new AuthorEmailColumn()		{ IsVisible = false },
         });
 }
Exemple #16
0
        public override void OnPaintColumnBackground(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
        {
            switch (paintEventArgs.State)
            {
            case ItemState.None:
                RenderColumnNormalBackground(paintEventArgs);
                break;

            case ItemState.Pressed:
                RenderColumnPressedBackground(column, paintEventArgs);
                break;

            default:
                RenderColumnHoverBackground(column, paintEventArgs);
                break;
            }
        }
Exemple #17
0
        public override void OnPaintColumnContent(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
        {
            var graphics = paintEventArgs.Graphics;
            var rect     = paintEventArgs.Bounds;
            var font     = column.HeaderFont;

            ItemPaintEventArgs.PrepareContentRectangle(ref rect);
            paintEventArgs.PrepareTextRectangle(font, font, ref rect);
            if (column.Extender != null && ((paintEventArgs.State & (ItemState.Hovered | ItemState.Pressed)) != ItemState.None))
            {
                rect.Width -= CustomListBoxColumn.ExtenderButtonWidth;
                if (rect.Width <= 0)
                {
                    return;
                }
            }
            StringFormat format;

            switch (column.HeaderAlignment)
            {
            case StringAlignment.Near:
                format = GitterApplication.TextRenderer.LeftAlign;
                break;

            case StringAlignment.Far:
                format = GitterApplication.TextRenderer.RightAlign;
                break;

            case StringAlignment.Center:
                format = GitterApplication.TextRenderer.CenterAlign;
                break;

            default:
                format = GitterApplication.TextRenderer.LeftAlign;
                break;
            }
            GitterApplication.TextRenderer.DrawText(graphics, column.Name, font, column.HeaderBrush, rect, format);
        }
Exemple #18
0
        /// <summary>Create <see cref="StashListBox"/>.</summary>
        public StashListBox()
        {
            Columns.AddRange(new[]
                {
                    _colHash			= new HashColumn(),
                    _colCommitDate		= new CommitDateColumn(),
                    _colSubject			= new SubjectColumn(false)
                    {
                        AlignToGraph = false,
                        ShowLocalBranches = false,
                        ShowRemoteBranches = false,
                        ShowTags = false,
                        ShowStash = false,
                    },
                    _colCommitter		= new CommitterColumn(),
                    _colCommitterEmail	= new CommitterEmailColumn(),
                    _colAuthorDate		= new AuthorDateColumn(),
                    _colAuthor			= new AuthorColumn(),
                    _colAuthorEmail		= new AuthorEmailColumn(),
                });

            Text = Resources.StrsNothingStashed;
        }
Exemple #19
0
        protected ExtenderBase(CustomListBoxColumn column)
        {
            Verify.Argument.IsNotNull(column, "column");

            _column = column;

            AutoScaleDimensions = new SizeF(96F, 96F);
            AutoScaleMode       = AutoScaleMode.Dpi;
            BorderStyle         = BorderStyle.FixedSingle;
            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                Font      = SystemFonts.MessageBoxFont;
                BackColor = SystemColors.Window;
            }
            else
            {
                Font      = GitterApplication.FontManager.UIFont;
                BackColor = _column.Style.Colors.Window;
                ForeColor = _column.Style.Colors.WindowText;
            }

            _column.StyleChanged += OnColumnStyleChanged;
        }
Exemple #20
0
        protected ExtenderBase(CustomListBoxColumn column)
        {
            Verify.Argument.IsNotNull(column, "column");

            _column = column;

            AutoScaleDimensions	= new SizeF(96F, 96F);
            AutoScaleMode		= AutoScaleMode.Dpi;
            BorderStyle			= BorderStyle.FixedSingle;
            if(LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                Font		= SystemFonts.MessageBoxFont;
                BackColor	= SystemColors.Window;
            }
            else
            {
                Font		= GitterApplication.FontManager.UIFont;
                BackColor	= _column.Style.Colors.Window;
                ForeColor	= _column.Style.Colors.WindowText;
            }

            _column.StyleChanged += OnColumnStyleChanged;
        }
Exemple #21
0
        public CustomListBoxTextEditor StartTextEditor(CustomListBoxColumn column, string text)
        {
            Verify.State.IsTrue(IsAttachedToListBox);

            return(ListBox.StartTextEditor(this, column, ListBox.Font, text));
        }
Exemple #22
0
 protected Rectangle GetColumnDisplayRect(CustomListBoxColumn column)
 {
     if(!column.IsVisible) return Rectangle.Empty;
     return new Rectangle(column.Left + _headersArea.Left, _headersArea.Top, column.Width, _headersArea.Height);
 }
Exemple #23
0
 internal CustomListBoxTextEditor StartTextEditor(CustomListBoxItem item, CustomListBoxColumn column, Font font, string text)
 {
     StopTextEditor();
     EnsureVisible(item);
     int id = _itemPlainList.IndexOf(item);
     int y = _itemsArea.Top + GetItemY1Offset(id);
     int x = column.Left;
     int w = column.Width;
     int h = _itemHeight;
     var rc = new Rectangle(x, y, w, h);
     _textEditor = new TextBox()
     {
         Font				= font,
         BorderStyle			= BorderStyle.FixedSingle,
         Text				= text,
         BackColor			= Style.Colors.Window,
         ForeColor			= Style.Colors.WindowText,
         MinimumSize			= rc.Size,
         MaximumSize			= rc.Size,
         Bounds				= rc,
         Parent				= this,
         CausesValidation	= true,
     };
     _textEditor.Focus();
     _textEditor.SelectAll();
     return new CustomListBoxTextEditor(this, _textEditor);
 }
Exemple #24
0
        public CustomListBoxTextEditor StartTextEditor(CustomListBoxColumn column, string text)
        {
            Verify.State.IsTrue(IsAttachedToListBox);

            return ListBox.StartTextEditor(this, column, ListBox.Font, text);
        }
Exemple #25
0
 private void HandleHeaderDefaultMouseDown(int itemIndex, MouseEventArgs e)
 {
     switch(e.Button)
     {
         case MouseButtons.Left:
             if(_allowColumnReorder)
             {
                 if(_columns.Count > 1)
                 {
                     _draggedHeaderPositionIndex = _draggedHeaderIndex = itemIndex;
                 }
                 if(_draggedHeaderIndex != -1)
                 {
                     _draggedHeader = _columns[itemIndex];
                     _draggedHeaderPosition = GetColumnX(itemIndex) - HScrollPos;
                     _headerDragHelper.Start(e.X, e.Y);
                     InvalidateColumn(_draggedHeaderIndex);
                 }
                 else
                 {
                     _draggedHeader = null;
                 }
             }
             else
             {
                 _draggedHeader = null;
             }
             break;
         case MouseButtons.Right:
             {
                 var menu = new ContextMenuStrip();
                 foreach(var c in Columns)
                 {
                     var item = new ToolStripMenuItem(c.Name, null)
                     {
                         Tag = c,
                         Checked = c.IsVisible,
                     };
                     item.Click += (s, args) =>
                     {
                         var h = (CustomListBoxColumn)((ToolStripMenuItem)s).Tag;
                         h.IsVisible = !h.IsVisible;
                     };
                     menu.Items.Add(item);
                 }
                 menu.Items.Add(new ToolStripSeparator());
                 menu.Items.Add(new ToolStripMenuItem(
                     Resources.StrColumns.AddEllipsis(), null, (s, args) => StartColumnsDialog()));
                 Utility.MarkDropDownForAutoDispose(menu);
                 menu.Renderer = Style.ToolStripRenderer;
                 menu.Show(this, e.Location, ToolStripDropDownDirection.Default);
             }
             break;
     }
 }
 public ItemsContextMenuRequestEventArgs(ICollection<CustomListBoxItem> items, CustomListBoxColumn column, int columnIndex, int x, int y)
     : base(column, columnIndex, x, y)
 {
     _items = items;
 }
 public ItemsContextMenuRequestEventArgs(ICollection <CustomListBoxItem> items, CustomListBoxColumn column, int columnIndex, int x, int y)
     : base(column, columnIndex, x, y)
 {
     _items = items;
 }
 private void PaintColumnExtender(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
 {
     var bounds = paintEventArgs.Bounds;
     if(column.Extender != null && bounds.Width > CustomListBoxColumn.ExtenderButtonWidth)
     {
         var graphics = paintEventArgs.Graphics;
         using(var brush = new SolidBrush(ColorTable.Background))
         {
             graphics.FillRectangle(brush,
                 bounds.Right - CustomListBoxColumn.ExtenderButtonWidth - 0.5f, bounds.Y,
                 1, bounds.Height);
         }
         var foregroundColor = paintEventArgs.HoveredPart == ColumnHitTestResults.Extender ?
             ColorTable.HoverExtenderForeground : ColorTable.ExtenderForeground;
         using(var brush = new SolidBrush(foregroundColor))
         {
             const int ArrowSize = 4;
             var p1 = new Point(
                 bounds.Right - CustomListBoxColumn.ExtenderButtonWidth + CustomListBoxColumn.ExtenderButtonWidth / 2,
                 bounds.Y + bounds.Height - (bounds.Height - ArrowSize) / 2);
             var p2 = new Point(p1.X + ArrowSize, p1.Y - ArrowSize);
             var p3 = new Point(p1.X - ArrowSize + 1, p1.Y - ArrowSize);
             _triangle[0] = p1;
             _triangle[1] = p2;
             _triangle[2] = p3;
             graphics.FillPolygon(brush, _triangle);
         }
     }
 }
 public ItemContextMenuRequestEventArgs(CustomListBoxItem item, CustomListBoxColumn column, int columnIndex, int x, int y)
     : base(column, columnIndex, x, y)
 {
     _item = item;
 }
Exemple #30
0
 public abstract void OnPaintColumnContent(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs);
 private static void RenderColumnPressedBackground(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
 {
     var graphics = paintEventArgs.Graphics;
     var rect = paintEventArgs.Bounds;
     var c1 = Color.FromArgb(192, 203, 217);
     var c2 = Color.FromArgb(246, 247, 248);
     var c3 = Color.FromArgb(193, 204, 218);
     var c4 = Color.FromArgb(215, 222, 231);
     var c5 = Color.FromArgb(235, 238, 242);
     using(var p = new Pen(c1))
     {
         var rc = rect;
         rc.Y -= 1;
         rc.X += 1;
         rc.Width -= 2;
         graphics.DrawRectangle(p, rc);
     }
     using(var b = new SolidBrush(c2))
     {
         var rc = rect;
         rc.Y += 3;
         rc.X += 2;
         rc.Width -= 4;
         rc.Height -= 4;
         graphics.FillRectangle(b, rc);
     }
     using(var p = new Pen(c3))
     {
         var rc = rect;
         graphics.DrawLine(p, rc.X + 1, rc.Y + 0, rc.Right - 2, rc.Y + 0);
     }
     using(var p = new Pen(c4))
     {
         var rc = rect;
         graphics.DrawLine(p, rc.X + 1, rc.Y + 1, rc.Right - 2, rc.Y + 1);
     }
     using(var p = new Pen(c5))
     {
         var rc = rect;
         graphics.DrawLine(p, rc.X + 1, rc.Y + 2, rc.Right - 2, rc.Y + 2);
     }
     if(column.Extender != null)
     {
         if(rect.Width > CustomListBoxColumn.ExtenderButtonWidth)
         {
             graphics.FillRectangle(ExtenderBorderBrush, rect.Right - CustomListBoxColumn.ExtenderButtonWidth - 0.5f, rect.Y, 1, rect.Height - 1);
             graphics.DrawImage(ImgColumnExtender, rect.Right - CustomListBoxColumn.ExtenderButtonWidth + 4, rect.Y + 9, 7, 4);
         }
     }
 }
Exemple #32
0
 public abstract void OnPaintColumnBackground(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs);
Exemple #33
0
        public int GetOptimalColumnWidth(CustomListBoxColumn column)
        {
            Verify.Argument.IsNotNull(column, "column");
            var index = _columns.IndexOf(column);
            Verify.Argument.IsTrue(index != -1, "column", "Colum is not present in this collection.");

            int maxw = column.MinWidth;
            foreach(var item in _itemPlainList)
            {
                var s = item.MeasureSubItem(new SubItemMeasureEventArgs(GraphicsUtility.MeasurementGraphics, index, column));
                if(s.Width > maxw) maxw = s.Width;
            }
            return maxw;
        }
Exemple #34
0
 private static bool IsAbbreviateEnabled(CustomListBoxColumn column)
 {
     var rhc = column as HashColumn;
     if(rhc != null)
     {
         return rhc.Abbreviate;
     }
     else
     {
         return HashColumn.DefaultAbbreviate;
     }
 }
Exemple #35
0
 internal void InvalidateColumn(CustomListBoxColumn column)
 {
     if(column.IsVisible)
     {
         var x = column.Left - HScrollPos;
         var w = column.Width;
         var rect = new Rectangle(x + _headersArea.X, _headersArea.Y, w, _headersArea.Height);
         Invalidate(rect);
     }
 }
Exemple #36
0
 internal void InvalidateColumnContent(CustomListBoxColumn column)
 {
     int id = _columns.IndexOf(column);
     InvalidateColumnContent(id);
 }
 private static void RenderColumnHoverBackground(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
 {
     var graphics = paintEventArgs.Graphics;
     var rect = paintEventArgs.Bounds;
     var c1 = Color.FromArgb(227, 232, 238);
     var c2 = Color.FromArgb(241, 245, 251);
     using(var p = new Pen(c1))
     {
         var rc = rect;
         rc.Y -= 1;
         rc.Width -= 1;
         graphics.DrawRectangle(p, rc);
     }
     using(var b = new SolidBrush(c2))
     {
         var rc = rect;
         rc.X += 2;
         rc.Y += 1;
         rc.Width -= 4;
         rc.Height -= 3;
         graphics.FillRectangle(b, rc);
     }
     if(column.Extender != null)
     {
         if(rect.Width > CustomListBoxColumn.ExtenderButtonWidth)
         {
             if(paintEventArgs.HoveredPart == ColumnHitTestResults.Extender)
             {
                 graphics.FillRectangle(ExtenderHoveredBrush,
                     rect.Right - CustomListBoxColumn.ExtenderButtonWidth + 1.5f, rect.Y + 1.5f,
                     CustomListBoxColumn.ExtenderButtonWidth - 4, rect.Height - 4);
                 graphics.DrawRectangle(ExtenderBorderPenHovered,
                     rect.Right - CustomListBoxColumn.ExtenderButtonWidth, 0,
                     CustomListBoxColumn.ExtenderButtonWidth - 1, rect.Height - 1);
             }
             else
             {
                 graphics.FillRectangle(ExtenderBorderBrush,
                     rect.Right - CustomListBoxColumn.ExtenderButtonWidth - 0.5f, rect.Y,
                     1, rect.Height);
             }
             graphics.DrawImage(ImgColumnExtender,
                 rect.Right - CustomListBoxColumn.ExtenderButtonWidth + 4, rect.Y + 9,
                 7, 4);
         }
     }
 }
Exemple #38
0
 public abstract void OnPaintColumnBackground(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs);
 private void RenderColumnPressedBackground(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs)
 {
     var graphics = paintEventArgs.Graphics;
     var bounds = paintEventArgs.Bounds;
     var c1 = Color.FromArgb(63, 63, 70);
     var c2 = Color.FromArgb(0, 122, 204);
     using(var pen = new Pen(c1))
     {
         graphics.DrawLine(pen, bounds.Right - 1, 0, bounds.Right - 1, bounds.Bottom - 1);
         graphics.DrawLine(pen, bounds.X, bounds.Bottom - 1, bounds.Right, bounds.Bottom - 1);
     }
     using(var brush = new SolidBrush(c2))
     {
         var rc = bounds;
         rc.Width -= 1;
         rc.Height -= 1;
         graphics.FillRectangle(brush, rc);
     }
     PaintColumnExtender(column, paintEventArgs);
 }
Exemple #40
0
 public abstract void OnPaintColumnContent(CustomListBoxColumn column, ItemPaintEventArgs paintEventArgs);
 public SubItemMeasureEventArgs(Graphics graphics, int columnIndex, CustomListBoxColumn column)
 {
     _graphics = graphics;
     _columnIndex = columnIndex;
     _column = column;
 }
Exemple #42
0
 public SubItemMeasureEventArgs(Graphics graphics, int columnIndex, CustomListBoxColumn column)
 {
     _graphics    = graphics;
     _columnIndex = columnIndex;
     _column      = column;
 }