Ejemplo n.º 1
0
        private void DrawHeader(ListGroup group, DrawItemEventArgs e)
        {
            var caption = group.Title;

            e.Graphics.FillRectangle(UserBrushes.Window, e.Bounds);

            using (var font = new Font(e.Font, FontStyle.Bold))
            {
                if (group.Expanded)
                {
                    e.Graphics.DrawImage(Bitmaps.Load("ArrowDownGray"), e.Bounds.X + Dpi.ScaleX(5), e.Bounds.Y + Dpi.ScaleY(7));
                }
                else
                {
                    e.Graphics.DrawImage(Bitmaps.Load("ArrowGray"), e.Bounds.X + Dpi.ScaleX(7), e.Bounds.Y + Dpi.ScaleY(5));
                }

                var captionSize = e.Graphics.MeasureString(caption, font);
                e.Graphics.DrawString(caption, font, SystemBrushes.ControlText,
                                      e.Bounds.X + Dpi.ScaleX(14), e.Bounds.Y + (e.Bounds.Height - captionSize.Height) / 2);
            }
        }
Ejemplo n.º 2
0
        private void DrawHeader(ListGroup group, DrawItemEventArgs e)
        {
            var caption = group.Title;
            e.Graphics.FillRectangle(UserBrushes.Window, e.Bounds);

            using (var font = new Font(e.Font, FontStyle.Bold))
            {
                if (group.Expanded)
                    e.Graphics.DrawImage(Bitmaps.Load("ArrowDownGray"), e.Bounds.X + 5, e.Bounds.Y + 7);
                else
                    e.Graphics.DrawImage(Bitmaps.Load("ArrowGray"), e.Bounds.X + 7, e.Bounds.Y + 5);

                var captionSize = e.Graphics.MeasureString(caption, font);
                e.Graphics.DrawString(caption, font, SystemBrushes.ControlText,
                    e.Bounds.X + 14, e.Bounds.Y + (e.Bounds.Height - captionSize.Height) / 2);
            }
        }