コード例 #1
0
ファイル: Sharper.cs プロジェクト: oxysoft/PokeSharp
        protected override void OnPaint(PaintEventArgs pevent)
        {
            Graphics       g      = pevent.Graphics;
            GraphicsHelper helper = new GraphicsHelper(g);

            g.Clear(Parent.BackColor);

            GraphicsPath gp1 = helper.CreateRound(0, 0, 15, 15, 16);
            GraphicsPath gp2 = helper.CreateRound(4, 4, 7, 7, 7);

            Pen   p1 = new Pen(Color.FromArgb(209, 209, 209));
            Brush b1 = new SolidBrush(Color.FromArgb(88, 160, 215));
            Brush b2 = new SolidBrush(Color.FromArgb(233, 233, 233));

            g.FillPath(b2, gp1);
            g.DrawPath(p1, gp1);

            if (this.Checked)
            {
                g.FillPath(b1, gp2);
            }

            g.DrawString(this.Text, this.Font, Brushes.Black, new PointF(16 + 2, 2));
        }
コード例 #2
0
ファイル: Sharper.cs プロジェクト: oxysoft/PokeSharp
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics       g      = e.Graphics;
            GraphicsHelper helper = new GraphicsHelper(g);

            if (b1 == null)
            {
                b1 = new NoiseBrush(new WhiteNoise(Width, Height).SetRange(210, 240).Generate(), 0.4f);
            }

            g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

            g.Clear(BackColor);
            g.SmoothingMode = SmoothingMode.AntiAlias;

            Pen p1  = new Pen(Color.FromArgb(24, 24, 24));
            Pen p12 = new Pen(Color.FromArgb(135, 175, 235));
            Pen p2  = new Pen(Color.FromArgb(120, 120, 120));
            Pen p3  = new Pen(Color.FromArgb(123, 205, 254));
            Pen p4  = new Pen(Color.FromArgb(103, 164, 194));
            Pen p5  = new Pen(Color.FromArgb(60, 130, 170));
            Pen p6  = new Pen(Color.FromArgb(30, 70, 90));
            Pen p7  = new Pen(Color.FromArgb(190, 190, 190));

            GraphicsPath gp1 = helper.CreateRound(0, 0, Width - 1, Height - 2, 4);
            GraphicsPath gp2 = helper.CreateRound(1, 1, Width - 3, Height - 4, 4);

            LinearGradientBrush disabled = new LinearGradientBrush(ClientRectangle, Color.FromArgb(170, 170, 170), Color.FromArgb(140, 140, 140), 90f);
            LinearGradientBrush neither  = new LinearGradientBrush(ClientRectangle, Color.FromArgb(120, 190, 250), Color.FromArgb(100, 160, 190), 90f);
            LinearGradientBrush hover    = new LinearGradientBrush(ClientRectangle, Color.FromArgb(66, 190, 255), Color.FromArgb(37, 140, 190), 90f);
            LinearGradientBrush clicked  = new LinearGradientBrush(ClientRectangle, Color.FromArgb(77, 159, 207), Color.FromArgb(21, 103, 151), 90f);

            if (Enabled)
            {
                if (Hover)
                {
                    if (!Clicked)                       //Hovering
                    {
                        g.FillPath(hover, gp1);
                        g.DrawPath(p1, gp1);
                        g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
                        g.DrawLine(p5, new Point(2, Height - 3), new Point(Width - 3, Height - 3));
                        g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
                        g.DrawPath(p3, gp2);
                        g.FillPath(b1, gp1);
                    }
                    else                         //Clicked
                    {
                        g.FillPath(clicked, gp1);
                        g.DrawPath(p1, gp1);
                        g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
                        g.DrawLine(p6, new Point(2, Height - 3), new Point(Width - 3, Height - 3));
                        g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
                        g.DrawPath(p4, gp2);
                        g.FillPath(b1, gp1);
                    }
                }
                else                     //Neither
                {
                    g.FillPath(neither, gp1);
                    g.DrawPath(p1, gp1);
                    g.DrawPath(p12, gp2);
                    g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
                    g.FillPath(b1, gp1);
                }
            }
            else
            {
                g.FillPath(disabled, gp1);
                g.DrawPath(p1, gp1);
                g.DrawPath(p7, gp2);
                g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
                g.FillPath(b1, gp1);
            }
            Font  font = this.Font;
            SizeF sz1  = g.MeasureString(this.Text, font);

            if (Clicked)
            {
                sz1.Height -= 2;
            }

            g.DrawString(this.Text, font, Brushes.Black, new PointF((int)(Width / 2f - sz1.Width / 2f) + 1, (int)(Height / 2f - sz1.Height / 2f) + 1));
            g.DrawString(this.Text, font, Brushes.White, new PointF((int)(Width / 2f - sz1.Width / 2f), (int)(Height / 2f - sz1.Height / 2f)));
        }
コード例 #3
0
ファイル: Sharper.cs プロジェクト: Hakua/PokeSharp
		protected override void OnPaint(PaintEventArgs e) {
			Graphics g = e.Graphics;
			GraphicsHelper helper = new GraphicsHelper(g);

			if (b1 == null) b1 = new NoiseBrush(new WhiteNoise(Width, Height).SetRange(210, 240).Generate(), 0.4f);

			g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

			g.Clear(BackColor);
			g.SmoothingMode = SmoothingMode.AntiAlias;

			Pen p1 = new Pen(Color.FromArgb(24, 24, 24));
			Pen p12 = new Pen(Color.FromArgb(135, 175, 235));
			Pen p2 = new Pen(Color.FromArgb(120, 120, 120));
			Pen p3 = new Pen(Color.FromArgb(123, 205, 254));
			Pen p4 = new Pen(Color.FromArgb(103, 164, 194));
			Pen p5 = new Pen(Color.FromArgb(60, 130, 170));
			Pen p6 = new Pen(Color.FromArgb(30, 70, 90));
			Pen p7 = new Pen(Color.FromArgb(190, 190, 190));

			GraphicsPath gp1 = helper.CreateRound(0, 0, Width - 1, Height - 2, 4);
			GraphicsPath gp2 = helper.CreateRound(1, 1, Width - 3, Height - 4, 4);

			LinearGradientBrush disabled = new LinearGradientBrush(ClientRectangle, Color.FromArgb(170, 170, 170), Color.FromArgb(140, 140, 140), 90f);
			LinearGradientBrush neither = new LinearGradientBrush(ClientRectangle, Color.FromArgb(120, 190, 250), Color.FromArgb(100, 160, 190), 90f);
			LinearGradientBrush hover = new LinearGradientBrush(ClientRectangle, Color.FromArgb(66, 190, 255), Color.FromArgb(37, 140, 190), 90f);
			LinearGradientBrush clicked = new LinearGradientBrush(ClientRectangle, Color.FromArgb(77, 159, 207), Color.FromArgb(21, 103, 151), 90f);

			if (Enabled) {
				if (Hover) {
					if (!Clicked) { //Hovering
						g.FillPath(hover, gp1);
						g.DrawPath(p1, gp1);
						g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
						g.DrawLine(p5, new Point(2, Height - 3), new Point(Width - 3, Height - 3));
						g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
						g.DrawPath(p3, gp2);
						g.FillPath(b1, gp1);
					} else { //Clicked
						g.FillPath(clicked, gp1);
						g.DrawPath(p1, gp1);
						g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
						g.DrawLine(p6, new Point(2, Height - 3), new Point(Width - 3, Height - 3));
						g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
						g.DrawPath(p4, gp2);
						g.FillPath(b1, gp1);
					}
				} else { //Neither
					g.FillPath(neither, gp1);
					g.DrawPath(p1, gp1);
					g.DrawPath(p12, gp2);
					g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
					g.FillPath(b1, gp1);
				}
			} else {
				g.FillPath(disabled, gp1);
				g.DrawPath(p1, gp1);
				g.DrawPath(p7, gp2);
				g.DrawLine(p2, new Point(2, Height - 1), new Point(Width - 3, Height - 1));
				g.FillPath(b1, gp1);
			}
			Font font = this.Font;
			SizeF sz1 = g.MeasureString(this.Text, font);

			if (Clicked) {
				sz1.Height -= 2;
			}

			g.DrawString(this.Text, font, Brushes.Black, new PointF((int) (Width / 2f - sz1.Width / 2f) + 1, (int) (Height / 2f - sz1.Height / 2f) + 1));
			g.DrawString(this.Text, font, Brushes.White, new PointF((int) (Width / 2f - sz1.Width / 2f), (int) (Height / 2f - sz1.Height / 2f)));
		}
コード例 #4
0
ファイル: Sharper.cs プロジェクト: Hakua/PokeSharp
		protected override void OnPaint(PaintEventArgs pevent) {
			Graphics g = pevent.Graphics;
			GraphicsHelper helper = new GraphicsHelper(g);

			g.Clear(Parent.BackColor);

			GraphicsPath gp1 = helper.CreateRound(0, 0, 15, 15, 16);
			GraphicsPath gp2 = helper.CreateRound(4, 4, 7, 7, 7);

			Pen p1 = new Pen(Color.FromArgb(209, 209, 209));
			Brush b1 = new SolidBrush(Color.FromArgb(88, 160, 215));
			Brush b2 = new SolidBrush(Color.FromArgb(233, 233, 233));

			g.FillPath(b2, gp1);
			g.DrawPath(p1, gp1);

			if (this.Checked) {
				g.FillPath(b1, gp2);
			}

			g.DrawString(this.Text, this.Font, Brushes.Black, new PointF(16 + 2, 2));
		}