Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Практика2.docx
Скачиваний:
6
Добавлен:
01.07.2025
Размер:
837.74 Кб
Скачать

Контрольный пример(6):

Описание программы № 7: Листинг(7):

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 WindowsFormsApplication7

{

public partial class Form1 : Form

{

string s1 = "admin";

string s2 = "admin";

string s3 = "12345";

string s4 = "12345";

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

this.Text = "Введите логин и пароль";

label1.Text = "Пользователь";

label2.Text = "Пароль";

textBox2.PasswordChar = '*';

}

private void button1_Click(object sender, EventArgs e)

{

string d1 = Convert.ToString(textBox1.Text);

string d2 = Convert.ToString(textBox2.Text);

if (((d1 == s1) && (d2 == s2)) || ((d1 == s3) && (d2 == s4)))

{

Form2 f2 = new Form2();

f2.Show();

MessageBox.Show("открыта 2 форма");

}

}

}

}

Контрольный пример(7):

Описание программы № 8: Листинг(8):

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Data.OleDb;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WindowsFormsApplication6

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

radioButton1.Text = "Муха села на варенье вот и все стихотворение";

radioButton2.Text = "Я памятник воздвиг себе не рукотворный...";

radioButton3.Text = "Зеленый";

radioButton4.Text = "Красный";

radioButton5.Text = "15 px";

radioButton6.Text = "18 px";

radioButton7.Text = "Times New Roman";

radioButton8.Text = "Arial";

}

private void radioButton1_CheckedChanged(object sender, EventArgs e)

{

label1.Text = radioButton1.Text;

}

private void radioButton2_CheckedChanged(object sender, EventArgs e)

{

label1.Text = radioButton2.Text;

}

private void radioButton3_CheckedChanged(object sender, EventArgs e)

{

label1.ForeColor = Color.Green;

}

private void radioButton4_CheckedChanged(object sender, EventArgs e)

{

label1.ForeColor = Color.Red;

}

private void radioButton5_CheckedChanged(object sender, EventArgs e)

{

label1.Font = new Font(label1.Font.Name, 15);

}

private void radioButton6_CheckedChanged(object sender, EventArgs e)

{

label1.Font = new Font(label1.Font.Name, 18);

}

private void radioButton7_CheckedChanged(object sender, EventArgs e)

{

this.label1.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));

}

private void radioButton8_CheckedChanged(object sender, EventArgs e)

{

this.label1.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));

}

}

}