예제 #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (fullTransparency)
            {
                Transparencer.MakeTransparent(this, e.Graphics);
            }
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            int    length    = Math.Min(Width, Height);
            PointF center    = new PointF(length / 2, length / 2);
            float  bigRadius = length / 2 - radius - (n - 1) * increment;
            float  unitAngle = 360 / n;

            next++;
            next = next >= n ? 0 : next;
            int a = 0;

            for (int i = next; i < next + n; i++)
            {
                int    factor  = i % n;
                float  c1X     = center.X + (float)(bigRadius * Math.Cos(unitAngle * factor * Math.PI / 180));
                float  c1Y     = center.Y + (float)(bigRadius * Math.Sin(unitAngle * factor * Math.PI / 180));
                float  currRad = radius + a * increment;
                PointF c1      = new PointF(c1X - currRad, c1Y - currRad);
                e.Graphics.FillEllipse(Brushes.Black, c1.X, c1.Y, 2 * currRad, 2 * currRad);
                using (Pen pen = new Pen(Color.White, 2))
                    e.Graphics.DrawEllipse(pen, c1.X, c1.Y, 2 * currRad, 2 * currRad);
                a++;
            }
        }
예제 #2
0
 protected override void OnPaint(PaintEventArgs e)
 {
     Transparencer.MakeTransparent(this, e.Graphics);
     #region Drawing
     e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
     int    length    = Math.Min(Width, Height);
     PointF center    = new PointF(length / 2, length / 2);
     int    bigRadius = length / 2 - radius;
     float  unitAngle = 360 / n;
     if (spin)
     {
         circleIndex++;
         circleIndex = circleIndex >= n ? circleIndex % n : circleIndex;
     }
     for (int i = 0; i < n; i++)
     {
         float  c1X  = center.X + (float)(bigRadius * Math.Cos(unitAngle * i * Math.PI / 180));
         float  c1Y  = center.Y + (float)(bigRadius * Math.Sin(unitAngle * i * Math.PI / 180));
         PointF loc1 = new PointF(c1X - radius, c1Y - radius);
         if (i == circleIndex)
         {
             using (SolidBrush brush = new SolidBrush(index))
                 e.Graphics.FillEllipse(brush, loc1.X, loc1.Y, 2 * radius, 2 * radius);
         }
         else
         {
             using (SolidBrush brush = new SolidBrush(other))
                 e.Graphics.FillEllipse(brush, loc1.X, loc1.Y, 2 * radius, 2 * radius);
         }
     }
     #endregion
 }
예제 #3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            shape     = new RoundedRectangleF(Width, Height, radius).Path;
            innerRect = new RoundedRectangleF(Width - 0.5f, Height - 0.5f, radius, 0.5f, 0.5f).Path;
            if (box.Height >= Height - 4)
            {
                Height = box.Height + 4;
            }
            box.Location = new Point(radius - 5, Height / 2 - box.Font.Height / 2);
            box.Width    = Width - (int)(radius * 1.5);

            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            Bitmap   bmp = new Bitmap(Width, Height);
            Graphics grp = Graphics.FromImage(bmp);

            e.Graphics.DrawPath(Pens.Gray, shape);
            using (SolidBrush brush = new SolidBrush(br))
                e.Graphics.FillPath(brush, innerRect);
            Transparencer.MakeTransparent(this, e.Graphics);

            base.OnPaint(e);
        }
예제 #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Transparencer.MakeTransparent(this, e.Graphics);

            #region Drawing

            Width  = Parent.Width;
            Height = Parent.Height;

            Point p1 = new Point(frameStroke, titleStroke);
            Point p2 = new Point(Width - frameStroke, titleStroke);
            Point p3 = new Point(Width - frameStroke, Height - frameStroke);
            Point p4 = new Point(frameStroke, Height - frameStroke);

            Point f1 = new Point(0, 0);
            Point f2 = new Point(Width, 0);
            Point f3 = new Point(Width, Height);
            Point f4 = new Point(0, Height);

            Rectangle rect1 = new Rectangle(f1.X, f1.Y, frameStroke, Height);
            Rectangle rect2 = new Rectangle(f1.X, f1.Y, Width, titleStroke);
            Rectangle rect3 = new Rectangle(p2.X, f2.Y, frameStroke, Height);
            Rectangle rect4 = new Rectangle(f4.X, p4.Y, Width, frameStroke);

            using (GraphicsPath path = new GraphicsPath())
                using (LinearGradientBrush brush = new LinearGradientBrush(rect1, titleColor, downColor, 90f))
                {
                    e.Graphics.FillRectangle(brush, rect1);
                    e.Graphics.FillRectangle(brush, rect2);
                    e.Graphics.FillRectangle(brush, rect3);
                    e.Graphics.FillRectangle(brush, rect4);

                    e.Graphics.FillPath(brush, path);
                }
            #endregion
            exitButton.Location = new Point(this.Width - frameStroke - exitButton.Width, 4);
            minButton.Location  = new Point(exitButton.Location.X - 10 - minButton.Width, exitButton.Location.Y);
        }
예제 #5
0
        protected override void OnPaint(PaintEventArgs e)
        {
            #region Transparency
            if (transparency)
            {
                Transparencer.MakeTransparent(this, e.Graphics);
            }
            #endregion

            #region Drawing
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            roundedRect = new RoundedRectangleF(Width, Height, radius);
            e.Graphics.FillRectangle(Brushes.Transparent, this.ClientRectangle);

            int R1 = (active1.R + inactive1.R) / 2;
            int G1 = (active1.G + inactive1.G) / 2;
            int B1 = (active1.B + inactive1.B) / 2;

            int R2 = (active2.R + inactive2.R) / 2;
            int G2 = (active2.G + inactive2.G) / 2;
            int B2 = (active2.B + inactive2.B) / 2;

            Rectangle rect = new Rectangle(0, 0, Width, Height);

            if (this.Enabled)
            {
                if (state == MouseState.Leave)
                {
                    using (LinearGradientBrush inactiveGB = new LinearGradientBrush(rect, inactive1, inactive2, 90f))
                        e.Graphics.FillPath(inactiveGB, roundedRect.Path);
                }
                else if (state == MouseState.Enter)
                {
                    using (LinearGradientBrush activeGB = new LinearGradientBrush(rect, active1, active2, 90f))
                        e.Graphics.FillPath(activeGB, roundedRect.Path);
                }
                else if (state == MouseState.Down)
                {
                    using (LinearGradientBrush downGB = new LinearGradientBrush(rect, Color.FromArgb(R1, G1, B1), Color.FromArgb(R2, G2, B2), 90f))
                        e.Graphics.FillPath(downGB, roundedRect.Path);
                }
                if (stroke > 0)
                {
                    using (Pen pen = new Pen(strokeColor, stroke))
                        e.Graphics.DrawPath(pen, new RoundedRectangleF(Width - stroke - (radius > 0?0:1), Height - stroke - (radius > 0?0:1), radius, stroke / 2, stroke / 2).Path);
                }
            }
            else
            {
                Color linear1 = Color.FromArgb(190, 190, 190);
                Color linear2 = Color.FromArgb(210, 210, 210);
                using (LinearGradientBrush inactiveGB = new LinearGradientBrush(rect, linear1, linear2, 90f))
                {
                    e.Graphics.FillPath(inactiveGB, roundedRect.Path);
                    e.Graphics.DrawPath(new Pen(inactiveGB), roundedRect.Path);
                }
            }


            #endregion

            #region Text Drawing
            using (StringFormat sf = new StringFormat()
            {
                LineAlignment = StringAlignment.Center,
                Alignment = StringAlignment.Center
            })
                using (Brush brush = new SolidBrush(ForeColor))
                    e.Graphics.DrawString(Text, Font, brush, this.ClientRectangle, sf);
            #endregion
            base.OnPaint(e);
        }