Ministerul Educaiei a Republicii Moldova
Universitatea Tehnic din Moldova
Facultatea Calculatoare, Informatic i Microelectronic
Raport
La disciplina: Programarea n Windows
Lucrrile de laborator nr.1-7 n C#
A efectuat: studentul gr. TI-151 Toma Ana
A verificat: Scrob Sergiu
Chiinu 2017
Scopul lucrrii: Aplicarea cunotiinelor acumulate din laboratoarele 1-7 n C#
Listingul programului:
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
Pen px = new Pen([Link](255, 255, 0, 0), 3);
Pen p = new Pen([Link](255, 255, 0, 0), 3);
Pen p2 = new Pen([Link](255, 0, 0, 0), 4);
Pen p3 = new Pen([Link](255, 0, 0, 0), 4);
int x11 = 480, y11 = 60, x12 = 480 , y12 = 80, x13 = 480, y13 = 95;
//bool chw = true, chr = false, chb = false;
int xs1 = 480, ys1 = 60, xs2 = 480, ys2 = 80, xs3 = 480, ys3 = 95;
bool on = true;
int cx = 480, cy = 130;
bool press = false;
int dx = 0, dy = 0;
Brush b1 = new SolidBrush([Link]);
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (press)
{
using (Graphics graphics = CreateGraphics())
{
[Link](b1, e.X, e.Y, 10, 10);
}
}
}
private void button2_Click(object sender, EventArgs e)
{
[Link]();
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
press = false;
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
press = true;
}
private void leftToolStripMenuItem_Click(object sender, EventArgs e)
{
dx -= 5;
}
private void rightToolStripMenuItem_Click(object sender, EventArgs e)
{
dx += 5;
}
private void downToolStripMenuItem_Click(object sender, EventArgs e)
{
dy += 5;
}
private void upToolStripMenuItem_Click(object sender, EventArgs e)
{
dy -= 5;
if (330 + dy < 300)
dy += 5;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
px = new Pen([Link](255, 0, 0, 255), 3);
b1 = new SolidBrush([Link]);
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
px = new Pen([Link](255, 255, 0, 0), 3);
b1 = new SolidBrush([Link]);
private void button1_Click(object sender, EventArgs e)
{
on = !on;
if (on == false)
[Link] = "Start";
else
[Link] = "Stop";
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
[Link] = "Laboratorul 8Toma Ana";
[Link] = true;
[Link] += new PaintEventHandler(Form1_Paint);
private void Form1_Paint(object sender, [Link] e)
{
[Link]([Link], 380, 30);
[Link](p2, 480, 130, x12, y12);
[Link](p3, 480, 130, x13, y13);
[Link](p3, 0, 300, 600, 300);
[Link](px, 500 + dx, 370 + dy, 340 + dx,
280 + dy, 420 + dx, 380 + dy, 350 + dx, 580 + dy);
private void timer1_Tick(object sender, EventArgs e)
{
if (on == false)
{
[Link](new Rectangle(0, 300, 600, 600));
[Link](new Rectangle(350, 0, 600, 300));
[Link](new Rectangle(0, 0, 100, 300));
return;
}
double u1 = ((6 * [Link]) * 3.14159265 / 180);
double u2 = ((6 * [Link]) * 3.14159265 / 180);
double u3 = ((30 * [Link] + 0.5 * [Link]) * 3.14159265 /
180);
x11 = (int)(xs1 * [Link](u1) - ys1 * [Link](u1) + cx - cx * [Link](u1) + cy *
[Link](u1));
y11 = (int)(xs1 * [Link](u1) + ys1 * [Link](u1) + cy - cx * [Link](u1) - cy *
[Link](u1));
x12 = (int)(xs2 * [Link](u2) - ys2 * [Link](u2) + cx - cx * [Link](u2) + cy *
[Link](u2));
y12 = (int)(xs2 * [Link](u2) + ys2 * [Link](u2) + cy - cx * [Link](u2) - cy *
[Link](u2));
x13 = (int)(xs3 * [Link](u3) - ys3 * [Link](u3) + cx - cx * [Link](u3) + cy *
[Link](u3));
y13 = (int)(xs3 * [Link](u3) + ys3 * [Link](u3) + cy - cx * [Link](u3) - cy *
[Link](u3));
[Link](new Rectangle(0, 300, 600, 600));
[Link](new Rectangle(350, 0, 600, 300));
[Link](new Rectangle(0, 0 , 100, 300));
}
}
}
Concluzie:
Am fcut cunotiin cu limbajul C#.Am aplicat cunotiinele acumulate din laboratoarele 1-7 n
C#,folosind Visual [Link] fost utilizate diferite instrumente din [Link] invatat sintaxa
unui nou limbaj de programare ,care nu l-am folosit pina [Link] creat un ceas cu ajutorul
Cu ajutorul primitivelor GDI,la fel am desenat curba Bezier cu care am facut cunostinta la
lucrarea numarul 3 de [Link] aceasta lucrare de laborator am facut cunostinta cu
platforma .net care usureaza cu mult munca noastra,astfel am creat butoane radio pe care le
folosesc pentru a schimba culoarea curbei Bezier.