Amaliy matematika fakulteti
Axborot xavfsizligi yo’nalishi
481_22-guruh talabasi Murodov Ne’matning Algoritmik tillar va dasturlash fanidan topshirig’i
9-Variant:
Savol: Quyidagi hodisalarni ishlatish:
1 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
2 private void button1_VisibleChanged(object sender, EventArgs e)
3 private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
4 private void pictureBox1_EnabledChanged(object sender, EventArgs e)
5 private void listBox1_StyleChanged(object sender, EventArgs e) 6 private void tabControl1_Selected(object sender, TabControlEventArgs e)
7 private void progressBar1_StyleChanged(object sender, EventArgs e)
8 private void tabPage1_Paint(object sender, PaintEventArgs e)
Dastur kodi:
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 WindowsFormsApp11
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result = MessageBox.Show("Chiqishni tasdiqlaysizmi?", "Tasdiqlash", MessageBoxButtons.YesNo);
if (result == DialogResult.No)
{
e.Cancel = true;
}
}
private void button1_VisibleChanged(object sender, EventArgs e)
{
if (button1.Visible)
{
MessageBox.Show("Button ko'rinadi!");
}
else
{
MessageBox.Show("Button yopildi!");
}
}
private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
MessageBox.Show("Enter tugmasi bosildi!");
}
}
private void pictureBox1_EnabledChanged(object sender, EventArgs e)
{
if (pictureBox1.Enabled)
{
MessageBox.Show("PictureBox faol!");
}
else
{
MessageBox.Show("PictureBox faolsiz!");
}
}
private void listBox1_StyleChanged(object sender, EventArgs e)
{
if (listBox1.DrawMode != DrawMode.OwnerDrawFixed)
{
MessageBox.Show("ListBox uslubi o'zgartirildi!");
listBox1.DrawMode = DrawMode.OwnerDrawFixed;
}
}
private void tabControl1_Selected(object sender, TabControlEventArgs e)
{
MessageBox.Show("Tanlangan oyna o'zgardi!");
}
private void ChangeProgressBarStyle()
{
// Stilni yaratish
var progressBarStyle = new ProgressBar();
// ProgressBar stilini o'zgartirish
progressBarStyle.Style = ProgressBarStyle.Marquee;
// ProgressBar komponentiga yangi stilni bog'lash
progressBar1.Style = progressBarStyle.Style;
// Stil o'zgartirilganligini tekshirish
if (progressBar1.Style == progressBarStyle.Style)
{
MessageBox.Show("ProgressBar stil o'zgartirildi!");
}
}
private void progressBar1_StyleChanged(object sender, EventArgs e)
{
MessageBox.Show("ProgressBar uslubi o'zgartirildi!");
}
private void tabPage1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawString("Bu TabPage ichidagi yozuvlar", Font, Brushes.Black, new PointF(10, 10));
}
}
}
Dastur natijasi:
|