예제 #1
0
파일: GDIHelper.cs 프로젝트: wwkkww1983/WMS
 public static void FillPath(Graphics g, GraphicsPath path, Rectangle rect, GradientColor color)
 {
     using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(rect, color.First, color.Second, LinearGradientMode.Vertical))
     {
         linearGradientBrush.Blend.Factors   = color.Factors;
         linearGradientBrush.Blend.Positions = color.Positions;
         g.FillPath(linearGradientBrush, path);
     }
 }
예제 #2
0
파일: GDIHelper.cs 프로젝트: wwkkww1983/WMS
 public static void FillRectangle(Graphics g, Rectangle rect, GradientColor color)
 {
     if (rect.Width > 0 && rect.Height > 0 && g != null)
     {
         using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(rect, color.First, color.Second, LinearGradientMode.Vertical))
         {
             linearGradientBrush.Blend.Factors   = color.Factors;
             linearGradientBrush.Blend.Positions = color.Positions;
             g.FillRectangle(linearGradientBrush, rect);
         }
     }
 }
예제 #3
0
파일: GDIHelper.cs 프로젝트: wwkkww1983/WMS
 public static void FillRectangle(Graphics g, RoundRectangle roundRect, GradientColor color)
 {
     if (roundRect.Rect.Width > 0 && roundRect.Rect.Height > 0)
     {
         using (GraphicsPath path = roundRect.ToGraphicsBezierPath())
         {
             using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(roundRect.Rect, color.First, color.Second, LinearGradientMode.Vertical))
             {
                 linearGradientBrush.Blend.Factors   = color.Factors;
                 linearGradientBrush.Blend.Positions = color.Positions;
                 g.FillPath(linearGradientBrush, path);
             }
         }
     }
 }
예제 #4
0
파일: TXPanel.cs 프로젝트: wwkkww1983/WMS
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            int      num      = (BorderWidth > 0) ? BorderWidth : 0;
            Graphics graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            GradientColor  color     = new GradientColor(_BackBeginColor, _BackEndColor, null, null);
            Rectangle      rect      = new Rectangle(0, 0, base.Size.Width - 1, base.Size.Height - 1);
            RoundRectangle roundRect = new RoundRectangle(rect, new CornerRadius(_CornerRadius));

            GDIHelper.FillRectangle(graphics, roundRect, color);
            if (_BorderWidth > 0)
            {
                rect.X      += _BorderWidth - 1;
                rect.Y      += _BorderWidth - 1;
                rect.Width  -= _BorderWidth - 1;
                rect.Height -= _BorderWidth - 1;
                GDIHelper.DrawPathBorder(graphics, new RoundRectangle(rect, new CornerRadius(_CornerRadius)), _BorderColor, BorderWidth);
            }
        }
예제 #5
0
파일: GDIHelper.cs 프로젝트: wwkkww1983/WMS
        public static void FillPath(Graphics g, RoundRectangle roundRect, Color color1, Color color2, Blend blend)
        {
            GradientColor color3 = new GradientColor(color1, color2, blend.Factors, blend.Positions);

            FillRectangle(g, roundRect, color3);
        }