0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

cscの作法 その53

Posted at

概要

cscの作法、調べてみた。
ネコのイラストやってみた。

参考にしたページ

写真

image.png

サンプルコード

using System;
using System.Windows.Forms;
using System.Drawing;

class form1: Form {
	form1() {
		this.Text = "neko";
		ClientSize = new Size(700, 500);
	}
	protected override void OnPaint(PaintEventArgs e) {
		Graphics g = e.Graphics;
		g.DrawEllipse(new Pen(GetFaceBorderColor(), 5), GetFacePosition());
		g.DrawPolygon(new Pen(GetFaceBorderColor(), 5), GetLeftEarPosition());
		g.DrawPolygon(new Pen(GetFaceBorderColor(), 5), GetRightEarPosition());
		g.FillEllipse(new SolidBrush(GetFaceColor()), GetFacePosition());
		g.FillPolygon(new SolidBrush(GetFaceColor()), GetLeftEarPosition());
		g.FillPolygon(new SolidBrush(GetFaceColor()), GetRightEarPosition());
		g.FillEllipse(Brushes.Black, 190, 200, 15, 50);
		g.FillEllipse(Brushes.Black, 295, 200, 15, 50);
		g.DrawArc(new Pen(Color.Black, 5), new Rectangle(190, 270, 60, 60), 0, 180);
		g.DrawArc(new Pen(Color.Black, 5), new Rectangle(250, 270, 60, 60), 0, 180);
		g.DrawLine(new Pen(Color.Black, 5), new Point(5, 210), new Point(120, 225));
		g.DrawLine(new Pen(Color.Black, 5), new Point(0, 250), new Point(120, 250));
		g.DrawLine(new Pen(Color.Black, 5), new Point(5, 290), new Point(120, 275));
		g.DrawLine(new Pen(Color.Black, 5), new Point(380, 225), new Point(495, 210));
		g.DrawLine(new Pen(Color.Black, 5), new Point(380, 250), new Point(500, 250));
		g.DrawLine(new Pen(Color.Black, 5), new Point(380, 275), new Point(495, 290));
		base.OnPaint(e);
	}
	private Color GetFaceColor() {
		return Color.FromArgb(255, 221, 209, 174);
	}
	private Color GetFaceBorderColor() {
		return Color.FromArgb(255, 182, 156, 78);
	}
	private Rectangle GetFacePosition() {
		return new Rectangle(50, 100, 400, 280);
	}
	private Point[] GetLeftEarPosition() {
		return new Point[] {
			new Point(430, 30),
			new Point(430, 210),
			new Point(300, 110)
		};
	}
	private Point[] GetRightEarPosition() {
		return new Point[] {
			new Point(70, 30),
			new Point(70, 210),
			new Point(200, 110)
		};
	}
	[STAThread]
	public static void Main() {
		Application.Run(new form1());
	}
}

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?