Create() public static method

public static Create ( Rectangle rect ) : GraphicsPath
rect System.Drawing.Rectangle
return System.Drawing.Drawing2D.GraphicsPath
Beispiel #1
0
        protected override void OnResize(EventArgs e)
        {
            Region = new Region(RoundedRectangle.Create(0, 0, Width, Height, 7));

            closeButton.Location  = new Point(Width - closeButton.Width - 10, 7);
            resizeButton.Location = new Point(Width - closeButton.Width - 30, 7);

            base.OnResize(e);
        }
        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            base.OnPaintBackground(pevent);

            using (Brush sb = new SolidBrush(BackgroundColor))
            {
                pevent.Graphics.FillPath(sb, RoundedRectangle.Create(0, 0, Width - 10, 60, 5));
            }

            pevent.Graphics.DrawString(String.Format("{0}%", Zoom), UI.DefaultFont, Brushes.White, Width - 65, Height - 37);
        }
Beispiel #3
0
        protected void Draw(Graphics g)
        {
            g.SmoothingMode = SmoothingMode.AntiAlias;


            if (isPressed)
            {
                using (
                    var brush = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), settings.Pressed1,
                                                        settings.Pressed2))
                {
                    g.FillRectangle(brush, 0, 0, Width, Height);
                }
            }
            else if (isOver)
            {
                using (
                    var brush = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), settings.Over1,
                                                        settings.Over2))
                {
                    g.FillRectangle(brush, 0, 0, Width, Height);
                }
            }
            else
            {
                using (
                    var brush = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), settings.Normal1,
                                                        settings.Normal2))
                {
                    g.FillRectangle(brush, 0, 0, Width, Height);
                }
            }

            using (var p = new Pen(Brushes.Black))
            {
                p.Color = isOver ? settings.BorderOver : settings.Border;
                g.DrawPath(p, RoundedRectangle.Create(0, 0, Width - 2, Height - 2, 2));
            }


            g.TextRenderingHint = TextRenderingHint.AntiAlias;

            var sf = new StringFormat {
                Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center
            };

            using (var brush = new SolidBrush(settings.FontColor))
            {
                g.DrawString(Text, UI.DefaultFont, brush, new Rectangle(0, 0, Width, Height), sf);
            }
        }
Beispiel #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

            if (isOver)
            {
                using (Brush br = new SolidBrush(Color.FromArgb(255, 60, 60, 60)))
                {
                    GraphicsPath pth = RoundedRectangle.Create(0, 0, Width, Height, 3);
                    e.Graphics.FillPath(br, pth);
                }
                using (var pen = new Pen(Color.FromArgb(255, 100, 100, 100), 2))
                {
                    GraphicsPath pth2 = RoundedRectangle.Create(1, 1, Width - 2, Height - 2, 3);
                    e.Graphics.DrawPath(pen, pth2);
                }
            }

            if (!FileLoaded)
            {
                e.Graphics.DrawLine(Pens.Red, 0, 0, Width, Height);
                e.Graphics.DrawLine(Pens.Red, Width, 0, 0, Height);
                if (!FileLoaded && !backgroundWorker.IsBusy)
                {
                    backgroundWorker.RunWorkerAsync();
                }
            }
            else
            {
                e.Graphics.DrawImageUnscaled(thumbNail, (Width - thumbNail.Width) / 2, 150 - thumbNail.Height);
            }

            var sf = new StringFormat {
                Alignment = StringAlignment.Center
            };

            e.Graphics.DrawString(fileInfo.CreationTime.ToLongDateString(), UI.SmallFont, Brushes.White,
                                  new Rectangle(0, 150, Width, 160), sf);
            e.Graphics.DrawString(fileInfo.CreationTime.ToLongTimeString(), UI.SmallFont, Brushes.White,
                                  new Rectangle(0, 160, Width, 170), sf);

            e.Graphics.DrawImageUnscaled(Resources.close_default, 140, 150);

            base.OnPaint(e);
        }
Beispiel #5
0
 protected override void OnSizeChanged(EventArgs e)
 {
     Region = new Region(RoundedRectangle.Create(0, 0, Width - 1, Height - 1, 2));
     base.OnSizeChanged(e);
 }
Beispiel #6
0
 protected override void OnResize(EventArgs e)
 {
     Region = new Region(RoundedRectangle.Create(0, 0, Width, Height, 3));
     base.OnResize(e);
 }
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

            Color apper;
            Color lower;
            Color apper2;
            Color lower2;
            Pen   border1;
            Pen   border2;

            if (isMouseDown)
            {
                apper = Color.FromArgb(255, 185, 185, 185);
                lower = Color.FromArgb(255, 190, 190, 190);

                apper2 = Color.FromArgb(255, 177, 177, 177);
                lower2 = Color.FromArgb(255, 163, 163, 163);

                border1 = new Pen(Color.FromArgb(255, 62, 62, 62));
                border2 = new Pen(Color.FromArgb(255, 210, 210, 210));
            }
            else if (isMouseIn)
            {
                apper = Color.FromArgb(255, 242, 242, 242);
                lower = Color.FromArgb(255, 236, 236, 236);

                apper2 = Color.FromArgb(255, 223, 223, 223);
                lower2 = Color.FromArgb(255, 210, 210, 210);

                border1 = new Pen(Color.FromArgb(255, 100, 100, 100));
                border2 = new Pen(Color.FromArgb(255, 250, 250, 250));
            }
            else
            {
                apper = Color.FromArgb(255, 242, 242, 242);
                lower = Color.FromArgb(255, 236, 236, 236);

                apper2 = Color.FromArgb(255, 223, 223, 223);
                lower2 = Color.FromArgb(255, 210, 210, 210);

                border1 = new Pen(Color.FromArgb(255, 140, 140, 140));
                border2 = new Pen(Color.FromArgb(255, 250, 250, 250));
            }

            using (var brush = new LinearGradientBrush(new Point(0, 2), new Point(0, Height / 2), apper, lower))
            {
                e.Graphics.FillRectangle(brush, 0, 2, Width, Height / 2);
            }
            using (var brush = new LinearGradientBrush(new Point(0, Height / 2), new Point(0, Height - 2), apper2, lower2))
            {
                e.Graphics.FillRectangle(brush, 0, Height / 2, Width, Height - 2);
            }

            border2.Width = 2;

            GraphicsPath path2 = RoundedRectangle.Create(1, 1, Width - 3, Height - 3, 2);

            e.Graphics.DrawPath(border2, path2);
            GraphicsPath path1 = RoundedRectangle.Create(0, 0, Width - 1, Height - 1, 2);

            e.Graphics.DrawPath(border1, path1);

            border1.Dispose();
            border2.Dispose();

            if (selectedItem != null)
            {
                selectedItem.SpecialDrawingFunction(e.Graphics, new Rectangle(6, 3, Width - 1, Height - 1));
            }

            var triangle = new GraphicsPath();
            int tx       = Width - 17;
            int ty       = 7;

            triangle.AddLine(tx, ty, tx + 9, ty);
            triangle.AddLine(tx + 9, ty, tx + 5, ty + 7);
            triangle.AddLine(tx + 5, ty + 7, tx, ty);
            e.Graphics.FillPath(Brushes.Black, triangle);
        }
Beispiel #8
0
 protected override void OnPaintBackground(PaintEventArgs e)
 {
     Region = new Region(RoundedRectangle.Create(0, 0, Width, Height, 7));
     e.Graphics.Clear(Color.Transparent);
 }