Esempio n. 1
0
        public XBrush Gradient(Rect rect, Color color1, Color color2)
        {
            var brush = new XLinearGradientBrush(rect.ToRectangleF(), color1, color2, XLinearGradientMode.ForwardDiagonal);

            //m_items.Add(brush);
            return(brush);
        }
Esempio n. 2
0
        public static void DrawHandle(UI.Controls.Canvas canvas, XGraphics graphics, Palette palette, Rect bounds, DrawingContext context, bool alwaysAlpha, bool round)
        {
            if (bounds.Width <= 0 || bounds.Height <= 0)
            {
                return;
            }

            using (var quality = new Smoothing(graphics, XSmoothingMode.Default))
            {
                XBrush brush;
                Pen    pen;
                var    alpha = 180;

                if (context.Selected)
                {
                    if (!alwaysAlpha)
                    {
                        alpha = 255;
                    }
                    brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LemonChiffon), Color.FromArgb(alpha, Color.DarkOrange));
                    pen   = palette.Pen(Color.FromArgb(alpha, Color.Chocolate), 0);
                }
                else
                {
                    brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LightCyan), Color.FromArgb(alpha, Color.SteelBlue));
                    pen   = palette.Pen(Color.FromArgb(alpha, Color.Navy), 0);
                }

                if (round)
                {
                    graphics.DrawEllipse(brush, bounds.ToRectangleF());
//          graphics.DrawRectangle(new XPen(Color.Red), bounds.ToRectangleF() );
                    graphics.DrawEllipse(pen, bounds.ToRectangleF());
                }
                else
                {
                    graphics.DrawRectangle(brush, bounds.ToRectangleF());
                    graphics.DrawRectangle(pen, bounds.ToRectangleF());
                }
            }
        }
Esempio n. 3
0
 public XBrush Gradient(Rect rect, Color color1, Color color2)
 {
     var brush = new XLinearGradientBrush(rect.ToRectangleF(), color1, color2, XLinearGradientMode.ForwardDiagonal);
     //m_items.Add(brush);
     return brush;
 }
Esempio n. 4
0
        public static void DrawHandle(Canvas canvas, XGraphics graphics, Palette palette, Rect bounds, DrawingContext context, bool alwaysAlpha, bool round)
        {
            if (bounds.Width <= 0 || bounds.Height <= 0)
              {
            return;
              }

              using (var quality = new Smoothing(graphics, XSmoothingMode.Default))
              {
            XBrush brush;
            Pen pen;
            var alpha = 180;

            if (context.Selected)
            {
              if (!alwaysAlpha)
              {
            alpha = 255;
              }
              brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LemonChiffon), Color.FromArgb(alpha, Color.DarkOrange));
              pen = palette.Pen(Color.FromArgb(alpha, Color.Chocolate), 0);
            }
            else
            {
              brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LightCyan), Color.FromArgb(alpha, Color.SteelBlue));
              pen = palette.Pen(Color.FromArgb(alpha, Color.Navy), 0);
            }

            if (round)
            {
              graphics.DrawEllipse(brush, bounds.ToRectangleF());
              graphics.DrawEllipse(pen, bounds.ToRectangleF());
            }
            else
            {
              graphics.DrawRectangle(brush, bounds.ToRectangleF());
              graphics.DrawRectangle(pen, bounds.ToRectangleF());
            }
              }
        }