You are on page 1of 2

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.

Text; using System.Windows.Forms; using System.Drawing.Drawing2D; namespace Brushesexample { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void Form1_Paint(object sender, PaintEventArgs e) { Pen p = new Pen(Color.Azure, 5); //cream un dreptunghi pentru elipse int x = 10, y = 10, width = 200, height = 100; Rectangle r = new Rectangle(x, y, width, height); //cream o pensula solida SolidBrush s = new SolidBrush(Color.Chocolate); //umplem elipsa cu pensula solida e.Graphics.FillEllipse(s, r); y = 120; r = new Rectangle(x, y, width, height); //cream o pensula de hasurare HatchBrush h = new HatchBrush(HatchStyle.DiagonalCross, Color.Chocol ate, Color.Black); //umplem elipsa cu pensula de hasurare e.Graphics.FillEllipse(h, r); y = 230; r = new Rectangle(x, y, width, height); //cream o pensula cu gradient liniar LinearGradientBrush lg = new LinearGradientBrush(r, Color.Aqua, Colo r.BlueViolet, LinearGradientMode.Horizontal); //umplem elipsa cu pensula gradient liniar e.Graphics.FillEllipse(lg, r); x = 230; y = 15; width = 250; height = 310; r = new Rectangle(x, y, width, height);

//cream o pensula de textura TextureBrush t = new TextureBrush(Image.FromFile("pisica.jpg")); //umplem dreptunghiul cu pensula de textura e.Graphics.FillRectangle(t, r); p.Dispose(); } } }

You might also like