Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ЗМІСТ1.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
4.41 Mб
Скачать

Додаток а

Лістинг програми

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Diskretnaya_matematika;

using RobotaSMassivami;

namespace WindowsFormsApplication1

{

public partial class Form1 : Form

{

string per_mas_orig, drug_mas_orig, rez_mas;

string[] per_mas, drug_mas, rez_mas_orig;

bool er = false, ctb1 = false, ctb2 = false, nstrnull = false;

double n, k; string nstr; int[] nmas, newnmas;

int nmasind, kolch, kolelvmas; Int64 rezfacts;

bool ver1_ch = false; bool ver2_ch = false; int but1ind;

Rebro[] rebro; Vershina[] ver; int RebInd, VerInd, RebSame;

double fact(double chislo)

{

double rez = 1;

for (int i = 1; i <= chislo; i++) rez *= i; return rez;

}

int fact(int chislo)

{

int rez = 1;

for (int i = 1; i <= chislo; i++) rez *= i; return rez;

}

double vstep(double n, double k)

{

double rez = n;

for (int i = 1; i < k; i++)

rez *= n; return rez;

}

bool thisnumb(int i)

{

for (char j = '0'; j <= '9'; j++)

if (nstr[i] == j) return true; return false;

}

public Form1()

{

InitializeComponent();

this.ActiveControl = this.radioButton1;

label31.Visible = true; label28.Visible = false;

label1.Text = ""; label2.Text = "";

label8.Visible = true; label8.Text = "C";

label9.Visible = true; label9.Text = "n!";

label11.Visible = true; label11.Text = "k!(n-k)!";

label12.Visible = true; label13.Visible = true;

label14.Visible = true; but1ind = 0;

ver = new Vershina[170]; rebro = new Rebro[170];

RebInd = -1; VerInd = -1; RebSame = 0;

}

private void button1_Click(object sender, EventArgs e)

{

if (radioButton5.Checked) {

try

{ n = Convert.ToInt32(maskedTextBox1.Text); }

catch

{

label2.Text = ""; label1.Visible = true;

label1.Text = "Введіть число \"n\"! ";

er = true;

}

if (!er)

{

label1.Visible = true; label1.Text = "Відповідь:";

label2.Text = Convert.ToString(fact(n));

} er = false;

}

else if (radioButton6.Checked)

{

nstr = maskedTextBox1.Text; nmas = new int[100];

nmasind = -1; kolch = 0; kolelvmas = 0;

if ((nstr == "") | (nstr == " n1, n2,..."))

{

nstrnull = true; label1.Visible = true;

label1.Text = "Введіть числа n1, n2, ...";

label2.Text = "";

}

else

{

for (int i = 0; i < nstr.Length; i++)

{

if (thisnumb(i))

{

if (i == nstr.Length - 1)

{

nmasind++;

if (kolch == 0) nmas[nmasind] = Int32.Parse(nstr.Substring(i, 1));

else nmas[nmasind] = Int32.Parse(nstr.Substring(i - kolch, kolch + 1));

kolch = 0;

}

else if (thisnumb(i + 1)) kolch++;

else

{

nmasind++;

if (kolch == 0) nmas[nmasind] = Int32.Parse(nstr.Substring(i, 1));

else nmas[nmasind] = Int32.Parse(nstr.Substring(i - kolch, kolch + 1));

kolch = 0;

} } } }

if (!nstrnull)

{

foreach (int x in nmas) if (x != 0) kolelvmas++;

newnmas = new int[kolelvmas];

for (int i = 0; i < kolelvmas; i++) newnmas[i] = nmas[i];

rezfacts = 1;

foreach (int x in newnmas) rezfacts *= fact(x);

label1.Visible = true; label1.Text = "Відповідь:";

label2.Text = Convert.ToString((double)fact(kolelvmas) / rezfacts);

} else nstrnull = false;

}

else

{

try

{

n = Convert.ToInt32(maskedTextBox1.Text);

k = Convert.ToInt32(maskedTextBox2.Text);

}

catch

{

label2.Text = "";

label1.Text = "Введіть числа \"n\" та \"k\"! ";

er = true;

}

label1.Visible = true;

if (!er)

{

label1.Text = "Відповідь:";

if (radioButton1.Checked) label2.Text = Convert.ToString(fact(n) / (fact(k) * fact(n - k)));

else if (radioButton2.Checked) label2.Text = Convert.ToString((fact(k + n + 1)) / (fact(n - 1) * fact((k + n + 1 - (n - 1)))));

else if (radioButton3.Checked) label2.Text = Convert.ToString(fact(n) / fact(n - k));

else if (radioButton4.Checked) label2.Text = Convert.ToString(vstep(n, k));

} er = false;

} }

private void radioButton1_CheckedChanged(object sender, EventArgs e)

{

if (radioButton1.Checked)

{

label31.Visible = true; label28.Visible = false;

label1.Text = ""; label2.Text = "";

label8.Visible = true; label8.Text = "C";

label9.Visible = true; label9.Text = "n!";

label11.Visible = true; label11.Text = "k!(n-k)!";

label12.Visible = true; label13.Visible = true;

label14.Visible = true;

}

else

{

label31.Visible = false; label28.Visible = true;

label8.Visible = false; label9.Visible = false;

label11.Visible = false; label12.Visible = false;

label13.Visible = false; label14.Visible = false;

} }

private void radioButton2_CheckedChanged(object sender, EventArgs e)

{

if (radioButton2.Checked)

{

label28.Visible = true; label1.Text = "";

label2.Text = ""; label8.Visible = true;

label8.Text = "C"; label12.Visible = true;

label13.Visible = true; label14.Visible = true;

label16.Visible = true; label16.Text = "C";

label17.Visible = true; label17.Text = " n-1";

label18.Visible = true;

}

else

{

label28.Visible = false; label8.Visible = false;

label12.Visible = false; label13.Visible = false;

label14.Visible = false; label16.Visible = false;

label17.Visible = false; label18.Visible = false;

} }

private void radioButton3_CheckedChanged(object sender, EventArgs e)

{

if (radioButton3.Checked)

{

label30.Visible = true; label28.Visible = false;

label1.Text = ""; label2.Text = "";

label8.Visible = true; label8.Text = "A";

label9.Visible = true; label11.Visible = true;

label11.Text = " (n-k)!"; label12.Visible = true;

label13.Visible = true; label14.Visible = true;

}

else

{

label30.Visible = false; label28.Visible = true;

label8.Visible = false; label9.Visible = false;

label11.Visible = false; label12.Visible = false;

label13.Visible = false; label14.Visible = false;

} }

private void radioButton4_CheckedChanged(object sender, EventArgs e)

{

if (radioButton4.Checked)

{

label28.Visible = true; label1.Text = "";

label2.Text = ""; label8.Visible = true;

label8.Text = "A"; label12.Visible = true;

label13.Visible = true; label14.Visible = true;

label16.Visible = true; label16.Text = "n";

label17.Visible = true; label17.Text = "k";

}

else

{

label28.Visible = false; label8.Visible = false;

label12.Visible = false; label13.Visible = false;

label14.Visible = false; label16.Visible = false;

label17.Visible = false;

}

}

private void radioButton5_CheckedChanged(object sender, EventArgs e)

{

if (radioButton5.Checked)

{

label28.Visible = false; label1.Text = "";

label2.Text = ""; label8.Visible = true;

label8.Text = "P"; label12.Visible = true;

label12.Text = "n"; label14.Visible = true;

label16.Visible = true; label16.Text = "n!";

label15.Enabled = false; maskedTextBox2.Enabled = false;

}

else

{

label28.Visible = true; label8.Visible = false;

label12.Visible = false; label14.Visible = false;

label16.Visible = false; label15.Enabled = true;

maskedTextBox2.Enabled = true;

} }

private void radioButton6_CheckedChanged(object sender, EventArgs e)

{

if (radioButton6.Checked)

{

label29.Visible = true; label28.Visible = true;

label1.Text = ""; label2.Text = "";

label8.Visible = true; label8.Text = "P";

label12.Visible = true; label12.Text = "(n1, n2,..)";

label19.Visible = true; label20.Visible = true;

label21.Visible = true; label15.Enabled = false;

maskedTextBox2.Enabled = false;

if (maskedTextBox1.Text == " n") maskedTextBox1.Text = " n1, n2,...";

}

else

{

label28.Visible = false; label29.Visible = false;

label8.Visible = false; label12.Visible = false;

label12.Text = "n"; label19.Visible = false;

label20.Visible = false; label21.Visible = false;

label15.Enabled = true; maskedTextBox2.Enabled = true;

if (maskedTextBox1.Text == " n1, n2,...") maskedTextBox1.Text = " n";

} }

private void maskedTextBox2_TextChanged(object sender, EventArgs e)

{ if (label1.Text != "Результат:") label1.Text = ""; label2.Text = ""; }

private void maskedTextBox1_TextChanged(object sender, EventArgs e)

{ if (label1.Text != "Результат:") label1.Text = ""; label2.Text = ""; }

private void maskedTextBox1_Enter(object sender, EventArgs e)

{

if (maskedTextBox1.Text == " n") maskedTextBox1.Text = "";

if (!ctb1)

{

ctb1 = true; maskedTextBox1.Text = "";

maskedTextBox1.ForeColor = Color.Black;

} }

private void maskedTextBox2_Enter(object sender, EventArgs e)

{

if (maskedTextBox2.Text == " k") maskedTextBox2.Text = "";

if (!ctb2)

{

ctb2 = true; maskedTextBox2.Text = "";

maskedTextBox2.ForeColor = Color.Black;

} }

private void button2_Click(object sender, EventArgs e)

{

label32.Visible = false; label32.Text = "";

label33.Visible = false; label33.Text = "";

if ((maskedTextBox3.Text != "") & (maskedTextBox4.Text != ""))

{

per_mas_orig = maskedTextBox3.Text;

drug_mas_orig = maskedTextBox4.Text;

try {

per_mas = Massivi.V_massiv_strok(per_mas_orig);

drug_mas = Massivi.V_massiv_strok(drug_mas_orig);

}

catch

{ label5.Visible = true;

label5.Text = "Множини потрібно заповнювати через кому, пробіл, або кому з пробілом!";

label6.Visible = false; return;

}

rez_mas_orig = DiskrMath.Ob(per_mas, drug_mas);

label6.Text = "{ " + Massivi.V_stroku(rez_mas_orig) + " }";

label5.Visible = true; label5.Text = "Відповідь:";

label6.Visible = true;

}

else

{ label6.Visible = false; label5.Visible = true;

label5.Text = "Введіть початкові дані!";

} }

private void button3_Click(object sender, EventArgs e)

{

label32.Visible = false; label32.Text = "";

label33.Visible = false; label33.Text = "";

if ((maskedTextBox3.Text != "") & (maskedTextBox4.Text != ""))

{ per_mas_orig = maskedTextBox3.Text;

drug_mas_orig = maskedTextBox4.Text;

try {

per_mas = Massivi.V_massiv_strok(per_mas_orig);

drug_mas = Massivi.V_massiv_strok(drug_mas_orig);

}

catch {

label5.Visible = true;

label5.Text = "Множини потрібно заповнювати через кому, пробіл, або кому з пробілом!";

label6.Visible = false; return;

}

rez_mas_orig = DiskrMath.Per(per_mas, drug_mas);

rez_mas = Massivi.V_stroku(rez_mas_orig);

if (rez_mas != "")

{

label5.Visible = true; label5.Text = "Відповідь:";

label6.Visible = true; label6.Text = "{ " + rez_mas + " }";

}

else {

label5.Visible = true;

label5.Text = "Множини не перетинаються";

label6.Visible = false;

} }

else {

label6.Visible = false; label5.Visible = true;

label5.Text = "Введіть початкові дані!";

} }

private void button4_Click(object sender, EventArgs e)

{

label32.Visible = false; label32.Text = "";

label33.Visible = false; label33.Text = "";

if ((maskedTextBox3.Text != "") & (maskedTextBox4.Text != ""))

{ per_mas_orig = maskedTextBox3.Text;

drug_mas_orig = maskedTextBox4.Text;

try {

per_mas = Massivi.V_massiv_strok(per_mas_orig);

drug_mas = Massivi.V_massiv_strok(drug_mas_orig);

}

catch {

label5.Visible = true;

label5.Text = "Множини потрібно заповнювати через кому, пробіл, або кому з пробілом!";

label6.Visible = false; return;

}

rez_mas_orig = DiskrMath.Rizn(per_mas, drug_mas);

rez_mas = Massivi.V_stroku(rez_mas_orig);

if (rez_mas != "")

{

label6.Text = "{ " + rez_mas + " }"; label5.Visible = true;

label5.Text = "Відповідь:"; label6.Visible = true;

}

else {

label5.Visible = true; label5.Text = "Порожня множина";

label6.Visible = false;

} }

else {

label6.Visible = false; label5.Visible = true;

label5.Text = "Введіть початкові дані!";

} }

private void button5_Click(object sender, EventArgs e)

{

label32.Visible = false; label32.Text = "";

label33.Visible = false; label33.Text = "";

if ((maskedTextBox3.Text != "") & (maskedTextBox4.Text != ""))

{

per_mas_orig = maskedTextBox3.Text;

drug_mas_orig = maskedTextBox4.Text;

try {

per_mas = Massivi.V_massiv_strok(per_mas_orig);

drug_mas = Massivi.V_massiv_strok(drug_mas_orig);

}

catch {

label5.Visible = true;

label5.Text = "Множини потрібно заповнювати через кому, пробіл, або кому з пробілом!";

label6.Visible = false; return;

}

rez_mas_orig = DiskrMath.Dop(per_mas, drug_mas);

if (rez_mas_orig[0] != "")

{

label6.Text = "{ " + Massivi.V_stroku(rez_mas_orig) + " }";

label5.Visible = true; label5.Text = "Відповідь:";

label6.Visible = true;

}

else {

label5.Visible = true;

label5.Text = "Друга множина включає не всі елементи першої множини!";

label6.Visible = false;

} }

else {

label6.Visible = false; label5.Visible = true;

label5.Text = "Введіть початкові дані!";

} }

private void button6_Click(object sender, EventArgs e)

{

label32.Visible = false; label32.Text = "";

label33.Visible = false; label33.Text = "";

if ((maskedTextBox3.Text != "") & (maskedTextBox4.Text != ""))

{

per_mas_orig = maskedTextBox3.Text;

drug_mas_orig = maskedTextBox4.Text;

try {

per_mas = Massivi.V_massiv_strok(per_mas_orig);

drug_mas = Massivi.V_massiv_strok(drug_mas_orig);

}

catch {

label5.Visible = true;

label5.Text = "Множини потрібно заповнювати через кому, пробіл, або кому з пробілом!";

label6.Visible = false; return;

}

rez_mas_orig = DiskrMath.SimRizn(per_mas, drug_mas);

label6.Text = "{ " + Massivi.V_stroku(rez_mas_orig) + " }";

label5.Visible = true; label5.Text = "Відповідь:";

label6.Visible = true;

}

else {

label6.Visible = false; label5.Visible = true;

label5.Text = "Введіть початкові дані!";

} }

private void button7_Click(object sender, EventArgs e)

{

label32.Visible = false; label32.Text = "";

label33.Visible = false; label33.Text = "";

string rez_mas, rez_mas2, rez_mas3, rez_mas4;

if ((maskedTextBox3.Text != "") & (maskedTextBox4.Text != ""))

{

per_mas_orig = maskedTextBox3.Text;

drug_mas_orig = maskedTextBox4.Text;

try {

per_mas = Massivi.V_massiv_strok(per_mas_orig);

drug_mas = Massivi.V_massiv_strok(drug_mas_orig);

}

catch {

label5.Visible = true;

label5.Text = "Множини потрібно заповнювати через кому, пробіл, або кому з пробілом!";

label6.Visible = false; return;

}

rez_mas_orig = DiskrMath.DekartDob(per_mas, drug_mas);

rez_mas = "{ " + Massivi.V_stroku(rez_mas_orig) + " }";

if ((rez_mas.Length > 80) & (rez_mas.Length < 160))

{

rez_mas2 = rez_mas.Substring(0, 80);

rez_mas3 = rez_mas.Substring(80, (rez_mas.Length - 80));

label6.Text = rez_mas2; label32.Visible = true;

label32.Text = rez_mas3;

}

else if (rez_mas.Length >= 160) {

rez_mas2 = rez_mas.Substring(0, 80);

rez_mas3 = rez_mas.Substring(80, 80);

rez_mas4 = rez_mas.Substring(160, rez_mas.Length - 160);

label6.Text = rez_mas2; label32.Visible = true;

label32.Text = rez_mas3; label33.Visible = true;

label33.Text = rez_mas4;

}

else label6.Text = rez_mas; label5.Visible = true;

label5.Text = "Відповідь:"; label6.Visible = true;

}

else {

label6.Visible = false; label5.Visible = true;

label5.Text = "Введіть початкові дані!";

} }

private void button8_Click(object sender, EventArgs e)

{

label32.Visible = false; label32.Text = "";

label33.Visible = false; label33.Text = "";

if (maskedTextBox3.Text != "") {

per_mas_orig = maskedTextBox3.Text;

try { per_mas = Massivi.V_massiv_strok(per_mas_orig); }

catch {

label5.Visible = true;

label5.Text = "Множини потрібно заповнювати через кому, пробіл, або кому з пробілом!";

label6.Visible = false; return;

}

label6.Text = Convert.ToString(per_mas.Length);

label5.Visible = true; label5.Text = "Відповідь:";

label6.Visible = true;

}

else {

label6.Visible = false; label5.Visible = true;

label5.Text = "Введіть початкові дані!";

} }

private void tabControl1_Selected(object sender, TabControlEventArgs e)

{

if (tabControl1.SelectedIndex == 2)

{

tabControl1.Visible = false;

this.Size = new Size(969, 600); CenterToScreen();

} }

private void button9_Click(object sender, EventArgs e)

{

tabControl1.SelectedIndex = 0;

tabControl1.Visible = true;

this.Size = new Size(581, 368);

CenterToScreen(); label35.Visible = false;

label35.Text = "";

}

private void button10_Click(object sender, EventArgs e)

{

tabControl1.SelectedIndex = 1;

tabControl1.Visible = true;

this.Size = new Size(581, 368);

CenterToScreen(); label35.Visible = false;

label35.Text = "";

}

#region label1-label13

private void label41_MouseDown(object sender, MouseEventArgs e)

{ ver[0].Active = true; }

private void label52_MouseDown(object sender, MouseEventArgs e)

{ ver[11].Active = true; }

private void label52_MouseUp(object sender, MouseEventArgs e)

{

ver[11].Active = false;

if ((ver1_ch) & (!ver2_ch)) {

rebro[RebInd].MyPerLabel = label52;

ver2_ch = true; label35.Text = "Оберіть другу вершину";

}

else if ((ver1_ch) & (ver2_ch)) {

rebro[RebInd].MyPoslLabel = label52;

for (int i = 0; i < RebInd; i++)

{

if (((rebro[i].MyPerLabel == rebro[RebInd].MyPerLabel) & (rebro[i].MyPoslLabel == rebro[RebInd].MyPoslLabel))

| ((rebro[i].MyPerLabel == rebro[RebInd].MyPoslLabel) & (rebro[i].MyPoslLabel == rebro[RebInd].MyPerLabel)))

RebSame++;

}

if (RebSame == 0) {

this.Paint += new PaintEventHandler(rebro[RebInd].Line);

this.Refresh();

ver1_ch = false; ver2_ch = false;

label35.Visible = false; label35.Text = "";

}

else if (RebSame == 1) {

this.Paint += new PaintEventHandler(rebro[RebInd].DugaR);

this.Refresh();

ver1_ch = false; ver2_ch = false;

label35.Visible = false; label35.Text = "";

RebSame = 0;

}

else if (RebSame == 2) {

this.Paint += new PaintEventHandler(rebro[RebInd].DugaL);

this.Refresh();

ver1_ch = false; ver2_ch = false;

label35.Visible = false;

label35.Text = ""; RebSame = 0;

}

else {

ver1_ch = false; ver2_ch = false;

label35.Visible = true;

label35.Text = "Більше створювати ребер неможна!";

RebSame = 0;

} } }

private void label52_MouseMove(object sender, MouseEventArgs e)

{

if (ver[11].Active) {

ver[11].X += e.X - 10; ver[11].Y += e.Y - 10;

this.Paint += new PaintEventHandler(ver[11].Build);

this.label52.Location = new Point(ver[11].X + 4, ver[11].Y + 4);

this.Paint -= new PaintEventHandler(ver[11].Build);

this.Refresh();

} }

#endregion

private void button11_Click(object sender, EventArgs e)

{

but1ind++; VerInd++;

switch (but1ind)

{

case 1: {

label41.Visible = true;

ver[VerInd] = new Vershina(30, 30);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 2: {

label42.Visible = true;

ver[VerInd] = new Vershina(55, 55);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 3: {

label43.Visible = true;

ver[VerInd] = new Vershina(80, 80);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 4: {

label44.Visible = true;

ver[VerInd] = new Vershina(105, 105);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 5: {

label45.Visible = true;

ver[VerInd] = new Vershina(130, 130);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 6: {

label46.Visible = true;

ver[VerInd] = new Vershina(155, 155);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 7: {

label47.Visible = true;

ver[VerInd] = new Vershina(180, 180);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 8: {

label48.Visible = true;

ver[VerInd] = new Vershina(205, 205);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 9: {

label49.Visible = true;

ver[VerInd] = new Vershina(230, 230);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 10: {

label50.Visible = true;

ver[VerInd] = new Vershina(255, 255);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 11: {

label51.Visible = true;

ver[VerInd] = new Vershina(280, 280);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

case 12: {

label52.Visible = true;

ver[VerInd] = new Vershina(305, 305);

this.Paint += new PaintEventHandler(ver[VerInd].Build);

this.Refresh(); break; }

default: {

label35.Text = "Більше вершин створити неможна!";

label35.Visible = true; break; }

} }

private void button12_Click(object sender, EventArgs e)

{

if (!ver1_ch)

{

RebInd++; rebro[RebInd] = new Rebro();

if (!ver1_ch & !ver2_ch) {

label35.Text = "Оберіть першу вершину";

label35.Visible = true; ver1_ch = true;

} } } }

class Vershina

{

Pen versh_pen; public int X, Y;

public bool Active;

public Vershina(int x, int y)

{

X = x; Y = y; Active = false;

versh_pen = new Pen(Color.Black, 1);

}

public void Build(object sender, PaintEventArgs e)

{ e.Graphics.DrawEllipse(versh_pen, X, Y, 20, 20); } }

class Rebro

{

Point[] pon; Pen my_versh_pen;

public Label MyPerLabel, MyPoslLabel;

public Rebro()

{ my_versh_pen = new Pen(Color.Black, 1); }

public void Line(object sender, PaintEventArgs e)

{

if (MyPerLabel != MyPoslLabel)

e.Graphics.DrawLine(my_versh_pen, MyPerLabel.Location.X + 4, MyPerLabel.Location.Y + 4, MyPoslLabel.Location.X + 4, MyPoslLabel.Location.Y + 4);

else

e.Graphics.DrawEllipse(my_versh_pen, MyPerLabel.Location.X, MyPerLabel.Location.Y, 35, 35);

}

public void DugaR(object sender, PaintEventArgs e)

{

if (MyPerLabel == MyPoslLabel)

e.Graphics.DrawEllipse(my_versh_pen, MyPerLabel.Location.X - 1, MyPerLabel.Location.Y - 1, 45, 45);

else {

pon = new Point[4];

pon[0] = new Point(MyPerLabel.Location.X + 5, MyPerLabel.Location.Y + 5);

pon[3] = new Point(MyPoslLabel.Location.X + 5, MyPoslLabel.Location.Y + 5);

if (((MyPoslLabel.Location.X > MyPerLabel.Location.X) & (MyPoslLabel.Location.Y > MyPerLabel.Location.Y)) |

((MyPerLabel.Location.X > MyPoslLabel.Location.X) & (MyPerLabel.Location.Y > MyPoslLabel.Location.Y))) {

pon[1] = new Point((MyPerLabel.Location.X) + ((int)((uint)(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2) / 2)) + 15),

(MyPerLabel.Location.Y) + ((int)((uint)(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2) / 2)) - 10));

pon[2] = new Point((MyPerLabel.Location.X) + ((int)((uint)(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2)) +

(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2) / 2)) + 15), (MyPerLabel.Location.Y) + ((int)((uint)(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2)) +

(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2) / 2)) - 10));

}

else if (((MyPoslLabel.Location.X > MyPerLabel.Location.X) & (MyPoslLabel.Location.Y < MyPerLabel.Location.Y)) |

((MyPerLabel.Location.X > MyPoslLabel.Location.X) & (MyPerLabel.Location.Y < MyPoslLabel.Location.Y)) |

((MyPerLabel.Location.X == MyPoslLabel.Location.X) ^ (MyPerLabel.Location.Y == MyPoslLabel.Location.Y))) {

pon[1] = new Point((MyPerLabel.Location.X) + ((int)((uint)(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2) / 2)) - 15),

(MyPerLabel.Location.Y) + ((int)((uint)(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2) / 2)) - 10));

pon[2] = new Point((MyPerLabel.Location.X) + ((int)((uint)(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2)) +

(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2) / 2)) - 15), (MyPerLabel.Location.Y) + ((int)((uint)(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2)) +

(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2) / 2)) - 10));

} e.Graphics.DrawCurve(my_versh_pen, pon);

} }

public void DugaL(object sender, PaintEventArgs e)

{

if (MyPerLabel == MyPoslLabel)

e.Graphics.DrawEllipse(my_versh_pen, MyPerLabel.Location.X - 2, MyPerLabel.Location.Y - 2, 55, 55);

else {

pon = new Point[4];

pon[0] = new Point(MyPerLabel.Location.X + 5, MyPerLabel.Location.Y + 5);

pon[3] = new Point(MyPoslLabel.Location.X + 5, MyPoslLabel.Location.Y + 5);

if (((MyPoslLabel.Location.X > MyPerLabel.Location.X) & (MyPoslLabel.Location.Y > MyPerLabel.Location.Y)) |

((MyPerLabel.Location.X > MyPoslLabel.Location.X) & (MyPerLabel.Location.Y > MyPoslLabel.Location.Y))) {

pon[1] = new Point((MyPerLabel.Location.X) + ((int)((uint)(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2) / 2)) - 10),

(MyPerLabel.Location.Y) + ((int)((uint)(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2) / 2)) + 15));

pon[2] = new Point((MyPerLabel.Location.X) + ((int)((uint)(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2)) +

(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2) / 2)) - 10), (MyPerLabel.Location.Y) + ((int)((uint)(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2)) +

(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2) / 2)) + 15));

}

else if (((MyPoslLabel.Location.X > MyPerLabel.Location.X) & (MyPoslLabel.Location.Y < MyPerLabel.Location.Y)) |

((MyPerLabel.Location.X > MyPoslLabel.Location.X) & (MyPerLabel.Location.Y < MyPoslLabel.Location.Y)) |

((MyPerLabel.Location.X == MyPoslLabel.Location.X) | (MyPerLabel.Location.Y == MyPoslLabel.Location.Y))) {

pon[1] = new Point((MyPerLabel.Location.X) + ((int)((uint)(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2) / 2)) + 15),

(MyPerLabel.Location.Y) + ((int)((uint)(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2) / 2)) + 10));

pon[2] = new Point((MyPerLabel.Location.X) + ((int)((uint)(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2)) +

(((MyPoslLabel.Location.X - MyPerLabel.Location.X) / 2) / 2)) + 15), (MyPerLabel.Location.Y) + ((int)((uint)(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2)) +

(((MyPoslLabel.Location.Y - MyPerLabel.Location.Y) / 2) / 2)) + 10));

}

e.Graphics.DrawCurve(my_versh_pen, pon);

} } } }

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]