Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace VisualStudioLogo
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
- GraphicsPath gp = new GraphicsPath();
- gp.AddPolygon(new Point[]{
- new Point(0,30),
- new Point(30,0),
- new Point(60,0),
- new Point(73,15),
- new Point(88,0),
- new Point(115,0),
- new Point(140,30),
- new Point(140,53),
- new Point(108,90),
- new Point(82,90),
- new Point(67,73),
- new Point(50,90),
- new Point(30,90),
- new Point(0,60)
- });
- gp.AddPolygon(new Point[]{
- new Point(30,30),
- new Point(20,40),
- new Point(32,55),
- new Point(43,43)
- });
- gp.AddPolygon(new Point[]{
- new Point(110,30),
- new Point(125,45),
- new Point(115,55),
- new Point(100,40)
- });
- e.Graphics.DrawPath(Pens.Black, gp);
- //maken van een region uit het path
- Region rgn = new Region(gp);
- LinearGradientBrush brush = new LinearGradientBrush(new Point(0,0),
- new Point(100,100),
- Color.Yellow,
- Color.Yellow);
- //vul de region op met een brush
- e.Graphics.FillRegion(brush, rgn);
- brush.Dispose();
- //Markern gebied voor rode kleur
- GraphicsPath gpr = new GraphicsPath();
- gpr.AddPolygon(new Point[]{
- new Point(88,0),
- new Point(115,0),
- new Point(115,25),
- new Point(50,90),
- new Point(30,90),
- new Point(30,55)
- });
- e.Graphics.DrawPath(Pens.Black, gpr);
- //Markern gebied voor blauwe kleur
- GraphicsPath gpb = new GraphicsPath();
- gpb.AddPolygon(new Point[]{
- new Point(30,54),
- new Point(30,90),
- new Point(0,60),
- new Point(20,40)
- });
- gpb.AddPolygon(new Point[]{
- new Point(115,0),
- new Point(110,30),
- new Point(125,45),
- new Point(140,30)
- });
- e.Graphics.DrawPath(Pens.Black, gpb);
- //Markern gebied voor groene kleur
- GraphicsPath gpg = new GraphicsPath();
- gpg.AddPolygon(new Point[]{
- new Point(20,40),
- new Point(0,60),
- new Point(0,30),
- new Point(30,0),
- new Point(30,30)
- });
- gpg.AddPolygon(new Point[]{
- new Point(140,30),
- new Point(140,53),
- new Point(108,90),
- new Point(115,55),
- });
- e.Graphics.DrawPath(Pens.Black, gpg);
- //maken region en vullen rood
- e.Graphics.DrawPath(Pens.Black, gpr);
- LinearGradientBrush rbrush = new LinearGradientBrush(new Point(0, 0),
- new Point(100, 100),
- ControlPaint.LightLight(Color.Red),
- Color.Red);
- e.Graphics.FillRegion(rbrush, new Region(gpr));
- rbrush.Dispose();
- //maken region en vullen blauw
- e.Graphics.DrawPath(Pens.Black, gpb);
- LinearGradientBrush bbrush = new LinearGradientBrush(new Point(0, 0),
- new Point(100, 100),
- ControlPaint.LightLight(Color.Blue),
- Color.Blue);
- e.Graphics.FillRegion(bbrush, new Region(gpb));
- bbrush.Dispose();
- //maken region en vullen groen
- e.Graphics.DrawPath(Pens.Black, gpg);
- LinearGradientBrush gbrush = new LinearGradientBrush(new Point(0, 0),
- new Point(100, 100),
- ControlPaint.LightLight(Color.Green),
- Color.Green);
- e.Graphics.FillRegion(gbrush, new Region(gpg));
- gbrush.Dispose();
- base.OnPaint(e);
- }
- }
- }
Add Comment
Please, Sign In to add comment