0% found this document useful (0 votes)
14 views2 pages

Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

This document contains C# code that draws various shapes and text on a form using graphics methods. It creates pens, brushes and fonts and uses them to draw ellipses, rectangles, strings and fill shapes on the form.

Uploaded by

JelenaBlagojevic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

This document contains C# code that draws various shapes and text on a form using graphics methods. It creates pens, brushes and fonts and uses them to draw ellipses, rectangles, strings and fill shapes on the form.

Uploaded by

JelenaBlagojevic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
// Create a pen object:
Pen aPen = new Pen(Color.White, 20);
// Create a brush object with a transparent red color:
SolidBrush aBrush = new SolidBrush(Color.Yellow);
Pen aPen1 = new Pen(Color.Red, 5);
g.DrawEllipse(aPen1, new Rectangle(11, 1, 275, 275));
g.DrawRectangle(aPen, 20, 120, 260, 60);

SolidBrush cetka = new SolidBrush(Color.Blue);
g.FillRectangle(cetka, 20, 120, 130, 60);
cetka.Color = Color.Red;
g.FillRectangle(cetka, 150, 120, 130, 60);

cetka.Color = Color.Blue;

// Draw filled ellipse:
g.FillEllipse(aBrush, new Rectangle(50, 40, 200, 200));
// Draw ellipse:
g.DrawEllipse(aPen, new Rectangle(75, 65, 150, 150));

aPen.Color = Color.Red;
g.DrawEllipse(aPen, new Rectangle(80, 70, 140, 140));
aPen.Dispose();
Font slova = new Font("Algerian", 120, FontStyle.Italic);
aBrush.Color = Color.Blue;
g.DrawString("T", slova, aBrush, 25, 60);
Font slova2 = new Font("Algerian", 70, FontStyle.Italic);
g.DrawString("i", slova2, aBrush, 100, 115);
g.DrawString("d", slova2, aBrush, 120, 110);
g.DrawString("e", slova2, aBrush, 165, 105);
Font slova3 = new Font("Calibri", 32, FontStyle.Regular);
g.DrawString("", slova3, aBrush, 180, 175);

aBrush.Dispose();


}
private void InitializeComponent()
{
this.SuspendLayout();
//
// Form1
//
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);

}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}

You might also like