示例#1
0
 /// <summary>
 /// Paints the shadow for the window.
 /// </summary>
 /// <param name="e">A <see cref="PaintEventArgs"/> containing the event data.</param>
 protected void PaintShadow(NcPaintEventArgs e)
 {
     if (_hasShadow)
     {
         Color color1 = Color.FromArgb(0x30, 0, 0, 0);
         Color color2 = Color.FromArgb(0, 0, 0, 0);
         using (GraphicsPath path1 = new GraphicsPath())
         {
             Rectangle         rectShadow = GetShadowRectangle(e.Bounds);
             GraphicsContainer container1 = e.Graphics.BeginContainer();
             path1.StartFigure();
             path1.AddRectangle(rectShadow);
             path1.CloseFigure();
             using (PathGradientBrush brush2 = new PathGradientBrush(path1))
             {
                 brush2.CenterColor = color1;
                 brush2.CenterPoint = new Point(rectShadow.X + rectShadow.Width / 2,
                                                rectShadow.Y + rectShadow.Height / 2);
                 ColorBlend cb = new ColorBlend
                 {
                     Colors    = new[] { color1, color2 },
                     Positions = new[] { 0.0f, 1.0f }
                 };
                 brush2.InterpolationColors = cb;
                 using (Region region = e.Graphics.Clip)
                 {
                     //region.Exclude(ClientRectangle);
                     e.Graphics.Clip = region;
                     e.Graphics.FillRectangle(brush2, rectShadow);
                 }
             }
             e.Graphics.EndContainer(container1);
         }
     }
 }
示例#2
0
        protected void PaintBorder(NcPaintEventArgs e)
        {
            Rectangle rectBorder = GetBorderRectangle(e.Bounds);

            using (SolidBrush br = new SolidBrush(Color.FromArgb(255, _borderColor)))
            {
                Rectangle rectFill = new Rectangle(rectBorder.Left, rectBorder.Top, rectBorder.Width, 1);
                e.Graphics.FillRectangle(br, rectFill);
                rectFill = new Rectangle(rectBorder.Left, rectBorder.Bottom - 1, rectBorder.Width, 1);
                e.Graphics.FillRectangle(br, rectFill);
                rectFill = new Rectangle(rectBorder.Left, rectBorder.Top + 1, 1, rectBorder.Height - 2);
                e.Graphics.FillRectangle(br, rectFill);
                rectFill = new Rectangle(rectBorder.Right - 1, rectBorder.Top + 1, 1, rectBorder.Height - 2);
                e.Graphics.FillRectangle(br, rectFill);
            }
        }
示例#3
0
 protected virtual void OnNCPaint(NcPaintEventArgs e)
 {
     PaintShadow(e);
     PaintBorder(e);
 }
示例#4
0
 /// <summary>
 /// Paints the shadow for the window.
 /// </summary>
 /// <param name="e">A <see cref="PaintEventArgs"/> containing the event data.</param>
 protected void PaintShadow(NcPaintEventArgs e)
 {
     if (_hasShadow)
     {
         Color color1 = Color.FromArgb(0x30, 0, 0, 0);
         Color color2 = Color.FromArgb(0, 0, 0, 0);
         using (GraphicsPath path1 = new GraphicsPath())
         {
             Rectangle rectShadow = GetShadowRectangle(e.Bounds);
             GraphicsContainer container1 = e.Graphics.BeginContainer();
             path1.StartFigure();
             path1.AddRectangle(rectShadow);
             path1.CloseFigure();
             using (PathGradientBrush brush2 = new PathGradientBrush(path1))
             {
                 brush2.CenterColor = color1;
                 brush2.CenterPoint = new Point(rectShadow.X + rectShadow.Width / 2,
                     rectShadow.Y + rectShadow.Height / 2);
                 ColorBlend cb = new ColorBlend
                     {
                         Colors = new[] {color1, color2},
                         Positions = new[] {0.0f, 1.0f}
                     };
                 brush2.InterpolationColors = cb;
                 using (Region region = e.Graphics.Clip)
                 {
                     //region.Exclude(ClientRectangle);
                     e.Graphics.Clip = region;
                     e.Graphics.FillRectangle(brush2, rectShadow);
                 }
             }
             e.Graphics.EndContainer(container1);
         }
     }
 }
示例#5
0
        protected void PaintBorder(NcPaintEventArgs e)
        {
            Rectangle rectBorder = GetBorderRectangle(e.Bounds);

            using (SolidBrush br = new SolidBrush(Color.FromArgb(255, _borderColor)))
            {
                Rectangle rectFill = new Rectangle(rectBorder.Left, rectBorder.Top, rectBorder.Width, 1);
                e.Graphics.FillRectangle(br, rectFill);
                rectFill = new Rectangle(rectBorder.Left, rectBorder.Bottom - 1, rectBorder.Width, 1);
                e.Graphics.FillRectangle(br, rectFill);
                rectFill = new Rectangle(rectBorder.Left, rectBorder.Top + 1, 1, rectBorder.Height - 2);
                e.Graphics.FillRectangle(br, rectFill);
                rectFill = new Rectangle(rectBorder.Right - 1, rectBorder.Top + 1, 1, rectBorder.Height - 2);
                e.Graphics.FillRectangle(br, rectFill);
            }
        }
示例#6
0
 protected virtual void OnNCPaint(NcPaintEventArgs e)
 {
     PaintShadow(e);
     PaintBorder(e);
 }