Exemple #1
0
        public bool IsOutlineVisible(GraphicsPlus g, float x, float y, PenPlus pen)
        {
            bool ret;

            SetStatus(GdiPlus.GdipIsOutlineVisiblePathPoint(nativePath, x, y, pen.nativePen, g.nativeGraphics, out ret));
            return(ret);
        }
Exemple #2
0
        public bool IsVisible(GraphicsPlus g, float x, float y)
        {
            bool ret;

            SetStatus(GdiPlus.GdipIsVisiblePathPoint(nativePath, x, y, g.nativeGraphics, out ret));
            return(ret);
        }
Exemple #3
0
        public bool IsVisible(GraphicsPlus g, int x, int y)
        {
            bool ret;

            GdiPlus.GdipIsVisiblePathPoint(nativePath, x, y, g.nativeGraphics, out ret);
            return(ret);
        }
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="g">The graphics.</param>
 /// <param name="clip">The clip bounds for the control.</param>
 /// <param name="scaleFactor">The scale factor of the form.</param>
 /// <param name="doubleBuffered">Specifies wether the parent control uses double buffering.</param>
 /// <param name="gp">The gdi plus class for painting.</param>
 public FluidPaintEventArgs(Graphics g, Rectangle clip, SizeF scaleFactor, bool doubleBuffered, GraphicsPlus gp)
     : base()
 {
     this.Graphics = g;
     this.ControlBounds = clip;
     this.DoubleBuffered = true;
     this.GdiPlus = gp;
     this.ScaleFactor = scaleFactor;
     Region = g.Clip;
 }
Exemple #5
0
        public BitmapPlus(int width, int height, GraphicsPlus target)
        {
            Initialize();
            GpBitmap bitmap = new GpBitmap();

            lastResult = GdiPlus.GdipCreateBitmapFromGraphics(width,
                                                              height,
                                                              target.nativeGraphics,
                                                              out bitmap);

            SetNativeImage((GpImage)(IntPtr)bitmap);
        }
Exemple #6
0
        public BitmapPlus(int width, int height, GraphicsPlus target)
        {
            Initialize();
            GpBitmap bitmap = new GpBitmap();

            lastResult = GdiPlus.GdipCreateBitmapFromGraphics(width,
                                                                  height,
                                                                  target.nativeGraphics,
                                                                  out bitmap);

            SetNativeImage((GpImage)(IntPtr)bitmap);
        }
Exemple #7
0
 public bool IsVisible(GraphicsPlus g, Point point)
 {
     return(IsVisible(g, point.X, point.Y));
 }
Exemple #8
0
        protected virtual void PaintButtonBackground(FluidPaintEventArgs e)
        {
            const int const_radius = 8;

            if (this.shape != ButtonShape.Flat || IsDown)
            {
                Rectangle rect = ButtonRectangle;
                rect.Width--;
                rect.Height--;
                if (rect.Width < 1 || rect.Height < 1)
                {
                    return;
                }

                rect.Offset(e.ControlBounds.X, e.ControlBounds.Y);

                Graphics g = e.Graphics;

                int radius = e.ScaleX(const_radius);
                if (radius > rect.Width / 2) radius = rect.Width / 2;

                Color endColor = this.BackColor;
                if (!Enabled)
                {
                    endColor = ColorConverter.AlphaBlendColor(Color.Black, endColor, 128);
                }
                int alpha = Enabled ? 127 : 32;
                Color startColor = ColorConverter.AlphaBlendColor(endColor, Color.White, alpha);  //Color.FromArgb(0x7fffffff);
                Color borderColor = ColorConverter.AlphaBlendColor(endColor, Color.White, 100);

                GraphicShape shape = ButtonShapeToGraphic(this.shape);
                using (GraphicsPlus gp = new GraphicsPlus(g))
                {
                    if (GradientFill)
                    {
                        GraphicsPlus.GradientMode mode = IsDown ? GraphicsPlus.GradientMode.Bottom : GraphicsPlus.GradientMode.Top;
                        gp.GradientFillShape(rect, radius, startColor, endColor, mode, shape, corners);
                        using (PenPlus pen = new PenPlus(borderColor, (float)1))
                        {
                            gp.DrawShape(rect, radius, pen, shape, corners);
                        }
                    }
                    else
                    {
                        if (IsDown)
                        {
                            endColor = ColorConverter.AlphaBlendColor(endColor, endColor, 128);
                        }
                        gp.GradientFillShape(rect, radius, endColor, endColor, GraphicsPlus.GradientMode.Bottom, shape, corners);
                        using (PenPlus pen = new PenPlus(borderColor, (float)1))
                        {
                            gp.DrawShape(rect, radius, pen, shape, corners);
                        }
                    }
                }
            }
            PerformPaintButtonContent(e);
        }
Exemple #9
0
 public bool IsVisible(GraphicsPlus g, int x, int y)
 {
     bool ret;
     GdiPlus.GdipIsVisiblePathPoint(nativePath, x, y, g.nativeGraphics, out ret);
     return ret;
 }
Exemple #10
0
        /// <summary>
        /// Creates and paints the button bitmap of the virtual scrollbar.
        /// </summary>
        /// <param name="width">The width of the button.</param>
        /// <param name="height">The height of the button.</param>
        /// <returns>The button image.</returns>
        protected virtual Image CreateScrollButtonBitmap(int width, int height)
        {
            Bitmap bm = new Bitmap(width, height);
            using (Graphics g = Graphics.FromImage(bm))
            {
                int r = Math.Min(width, height / 2) - 1;
                if (r < 1) r = 1;

                backgroundBrush.Color = Color.Fuchsia;
                //g.Clear(Color.Fuchsia);
                g.FillRectangle(backgroundBrush, 0, 0, width, height);

                using (GraphicsPlus gp = new GraphicsPlus(g))
                {
                    Rectangle bounds = new Rectangle(0, 0, width - 1, height - 1);
                    gp.SmoothingMode = SmoothingMode.None;
                    Color color = scrollbarButtonColor;
                    using (SolidBrushPlus brush = new SolidBrushPlus(color, true))
                    {
                        gp.FillRoundRectangle(bounds, r, brush);
                    }
                    using (PenPlus pen = new PenPlus(ScrollBarButtonBorderColor, 1, true))
                    {
                        gp.DrawRoundRectangle(bounds, r, pen);
                    }
                }
            }

            return bm;
        }
Exemple #11
0
 public bool IsVisible(GraphicsPlus g, float x, float y)
 {
     bool ret;
     SetStatus(GdiPlus.GdipIsVisiblePathPoint(nativePath, x, y, g.nativeGraphics, out ret));
     return ret;
 }
Exemple #12
0
 public bool IsOutlineVisible(GraphicsPlus g, Point point, PenPlus pen)
 {
     return IsOutlineVisible(g, point.X, point.Y, pen);
 }
Exemple #13
0
 public bool IsOutlineVisible(GraphicsPlus g, float x, float y, PenPlus pen)
 {
     bool ret;
     SetStatus(GdiPlus.GdipIsOutlineVisiblePathPoint(nativePath, x, y, pen.nativePen, g.nativeGraphics, out ret));
     return ret;
 }
        private void PaintTemplateBackground()
        {
            Graphics g = Graphics;
            Rectangle r = ClientBounds;

            Color color = BackColor;
            if (IsTransparent)
            {
                color = ColorConverter.AlphaColor(color, 220);
                using (GraphicsPlus gp = new GraphicsPlus(g))
                {
                    using (SolidBrushPlus backGround = new SolidBrushPlus(color))
                    {
                        gp.FillRectangle(backGround, r);
                    }
                }
            }
            else
            {
                using (SolidBrush brush = new SolidBrush(color))
                {
                    g.FillRectangle(brush, r);
                }
            }
        }
        public void PaintHeaderBackground()
        {
            Graphics g = Graphics;
            Rectangle r = ClientBounds;

            Color color = BackColor;
            Color startColor = ColorConverter.AlphaBlendColor(Color.White, color, 100);
            if (IsTransparent)
            {
                color = ColorConverter.AlphaColor(color, 200);
                startColor = ColorConverter.AlphaColor(startColor, 150);
                using (GraphicsPlus gp = new GraphicsPlus(g))
                {
                    PointF p1 = new PointF(r.X, r.Y);
                    PointF p2 = new PointF(r.X, r.Bottom);
                    using (LinearGradientBrush backGround = new LinearGradientBrush(p1, p2, startColor, color))
                    {
                        gp.FillRectangle(backGround, r);
                    }
                }
            }
            else
            {
                GdiExt.GradientFill(g, r, startColor, color, GdiExt.FillDirection.TopToBottom);
            }
        }
Exemple #16
0
 public bool IsOutlineVisible(GraphicsPlus g, Point point, PenPlus pen)
 {
     return(IsOutlineVisible(g, point.X, point.Y, pen));
 }
Exemple #17
0
 public bool IsVisible(GraphicsPlus g, Point point)
 {
     return IsVisible(g, point.X, point.Y);
 }
Exemple #18
0
 protected virtual void OnPaintBackground(FluidPaintEventArgs e)
 {
     if (PaintBackground != null) PaintBackground(this, e);
     else
     {
         if (!BackColor.IsEmpty && BackColor != Color.Transparent)
         {
             Graphics g = e.Graphics;
             if (BackColor.A == 255 || BackColor.A == 0)
             {
                 SolidBrush brush = Brushes.GetBrush(BackColor);
                 g.FillRectangle(brush, e.ControlBounds);
             }
             else
             {
                 using (GraphicsPlus gp = new GraphicsPlus(g))
                 {
                     using (SolidBrushPlus brush = new SolidBrushPlus(BackColor))
                     {
                         gp.FillRectangle(brush, e.ControlBounds);
                     }
                 }
             }
         }
     }
 }