Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Модуль 2 / M2L5

.docx
Скачиваний:
64
Добавлен:
22.04.2016
Размер:
41.29 Кб
Скачать

1.

Текст программы:

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;

using static System.Math;

namespace Task_1

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

Graphics g = pictureBox1.CreateGraphics();

g.Clear(Color.Green);

g.FillEllipse(new SolidBrush(Color.Violet), pictureBox1.Width / 2, pictureBox1.Height / 2, 160, 160);

g.DrawEllipse(new Pen(Color.Red), pictureBox1.Width / 2, pictureBox1.Height / 2, 160, 160);

g.FillRectangle(new SolidBrush(Color.Blue), (pictureBox1.Width / 2)+160/7, (pictureBox1.Height / 2)+160/7, 115, 115);

g.DrawRectangle(new Pen(Color.Red), (pictureBox1.Width / 2) + 160 / 7, (pictureBox1.Height / 2) + 160 / 7, 115, 115);

string drawtext = "Односумов НС";

Font textFont = new Font("Arial", 10);

g.DrawString(drawtext, textFont, new SolidBrush(Color.White), ((pictureBox1.Width / 2) + 160 / 7)+10, (pictureBox1.Height - pictureBox1.Height/4)-10);

}

}

}

Скриншоты:

2.

Текст программы:

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;

using static System.Math;

namespace Task_2

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void pictureBox1_Click_1(object sender, EventArgs e)

{

Graphics g = pictureBox1.CreateGraphics();

g.DrawLine(new Pen(Color.Black), 0, 150, 300, 150);

g.DrawLine(new Pen(Color.Black), 150, 0, 150, 300);

double y;

for (float x = 0; x < 20; x += 20)

{

y = ((((x + 6.2) * (Tan(5 * x))) / ((3.2 * x + 5) * (3 * x - 4))) + 3.14 * (x - 2.5));

g.DrawLine(new Pen(Color.Red), x + 150, (float)y + 150, x + 160, (float)y + 160);

}

}

}

}

Скриншоты:

3.

Текст программы:

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 Task_3

{

public partial class Form1 : Form

{

Graphics g;

SolidBrush green = new SolidBrush(Color.Green);

SolidBrush red = new SolidBrush(Color.Red);

SolidBrush yellow = new SolidBrush(Color.Yellow);

SolidBrush stick = new SolidBrush(Color.Brown);

Pen star = new Pen(Color.Yellow);

float x = 100, y = 50, w = 100, h = 100;

public Form1()

{

InitializeComponent();

}

void pictureBox1_Click(object sender, EventArgs e)

{

g = pictureBox1.CreateGraphics();

/* g.FillRectangle(stick, 100, 50, 5, 500);

g.FillRectangle(green, x, y, w, h);

g.FillRectangle(red, x + 100, y, w, h);

g.FillRectangle(yellow, x + 200, y, w, h);

g.DrawLine(star, x + 125, y + 50, x + 175, y + 50);

g.DrawLine(star, x + 125, y + 50, x + 161, y + 75);

g.DrawLine(star, x + 161, y + 75, x + 150, y + 25);

g.DrawLine(star, x + 150, y + 25, x + 138, y + 75);

g.DrawLine(star, x + 138, y + 75, x + 175, y + 50);*/

y += 300;

for (float i = 0; i<300; i+=0.3F)

{

g.FillRectangle(new SolidBrush(Color.White), 0, 0, 600, 600);

g.FillRectangle(stick, 100, 50, 5, 500);

g.FillRectangle(green, x, y, w, h);

g.FillRectangle(red, x + 100, y, w, h);

g.FillRectangle(yellow, x + 200, y, w, h);

g.DrawLine(star, x + 125, y + 50, x + 175, y + 50);

g.DrawLine(star, x + 125, y + 50, x + 161, y + 75);

g.DrawLine(star, x + 161, y + 75, x + 150, y + 25);

g.DrawLine(star, x + 150, y + 25, x + 138, y + 75);

g.DrawLine(star, x + 138, y + 75, x + 175, y + 50);

y -= 0.3F;

}

}

}

}

Скриншот:

Соседние файлы в папке Модуль 2