Beispiel #1
0
        private void RecreateBitmap()
        {
            if (_bmpSelection != null)
            {
                _bmpSelection.Dispose();
            }
            _bmpSelection = new Bitmap(Width - 2, ITEM_HEIGHT);
            Graphics g = Graphics.FromImage(_bmpSelection);

            g.SmoothingMode = SmoothingMode.AntiAlias;
            Rectangle    selRect  = new Rectangle(1, 1, _bmpSelection.Width - 2, _bmpSelection.Height - 2);
            GraphicsPath fillPath = GraphicsUtils.GetRoundedRectanglePath(selRect, SELECTION_RADIUS);

            selRect.Width--;
            selRect.Height--;
            GraphicsPath drawPath = GraphicsUtils.GetRoundedRectanglePath(selRect, SELECTION_RADIUS);

            using (Brush brush = new LinearGradientBrush(selRect, Color.FromArgb(227, 238, 253), Color.FromArgb(216, 233, 252), 90))
                g.FillPath(brush, fillPath);
            using (Pen pen = new Pen(Color.FromArgb(124, 163, 206)))
                g.DrawPath(pen, drawPath);
            g.Dispose();
        }
Beispiel #2
0
 private static void DrawRoundedRectangle(Graphics g, Rectangle rect, int radius, Color color)
 {
     using (Pen pen = new Pen(color))
         using (GraphicsPath path = GraphicsUtils.GetRoundedRectanglePath(rect, radius))
             g.DrawPath(pen, path);
 }