1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApp7
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- Graphics n;
- private void Form1_Paint(object sender, PaintEventArgs e)
- {
- // Массив точек треугольника
- Point[] points = new Point[4];
- points[0].X = 188; points[0].Y = 100;
- points[1].X = 287; points[1].Y = 87;
- points[2].X = 346; points[2].Y = 147;
- points[3].X = 321; points[3].Y = 210;
- Point[] points1 = new Point[3];
- points1[0].X = 321; points1[0].Y = 210;
- points1[1].X = 267; points1[1].Y = 165;
- points1[2].X = 210; points1[2].Y = 210;
- // Изображение, которое будет в результате
- Bitmap bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
- using (Graphics n = Graphics.FromImage(bmp))
- {
- // Рисуем
- n.Clear(Color.White);
- SolidBrush A = new SolidBrush(Color.Turquoise);
- n.FillPolygon(A, points);
- SolidBrush B = new SolidBrush(Color.MediumTurquoise);
- n.FillPolygon(B, points1);
- }
- // Устанавливаем изображение.
- pictureBox1.Image = bmp;
- }
- }
- }
|