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

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

This document defines a Windows form with a partial class that inherits from the Form class. The form overrides the OnPaint method to draw various graphics on the form, including filling ellipses with different colors, drawing pie slices, and drawing letters inside the ellipses using different fonts and colors.

Uploaded by

Igor Rodjan
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)
44 views2 pages

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

This document defines a Windows form with a partial class that inherits from the Form class. The form overrides the OnPaint method to draw various graphics on the form, including filling ellipses with different colors, drawing pie slices, and drawing letters inside the ellipses using different fonts and colors.

Uploaded by

Igor Rodjan
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;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// this.SetStyle(ControlStyles.ResizeRedraw, true);
this.BackColor = Color.GhostWhite;
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen aPen = new Pen(Color.Black, 4);
SolidBrush aBrush = new SolidBrush(Color.Black);

g.FillEllipse(aBrush, new Rectangle(40, 40, 200, 200));


g.FillEllipse(Brushes.White, new Rectangle(90, 90, 100, 100));

g.FillPie(Brushes.Blue, new Rectangle(90, 90,100,100), -180, 90);


g.FillPie(Brushes.Blue, new Rectangle(90, 90, 100, 100), 0, 90);

String drawString = "B";


Font drawFont = new Font("Arial", 30);
SolidBrush drawBrush = new SolidBrush(Color.White);
PointF drawPoint = new PointF(55.0f,80.0f);
e.Graphics.DrawString(drawString, drawFont, drawBrush, drawPoint);

String m = "M";
Font fm = new Font("Arial", 30);
SolidBrush dB = new SolidBrush(Color.White);
PointF dP = new PointF(115.0f, 45.0f);
e.Graphics.DrawString(m, fm, dB, dP);

String W= "W";
Font fm1 = new Font("Arial", 30);
SolidBrush dB1 = new SolidBrush(Color.White);
PointF dP1 = new PointF(177.0f, 80.0f);
e.Graphics.DrawString(W, fm1, dB1, dP1);
}

You might also like