Reja: I. Kirish visual C# haqida Microsoft Visual C# da konsol ilova dasturlar yaratish Microsoft Visual Studioda WinForm loyiha yaratish II. Asosiy qism
Download 1.64 Mb.
|
ibroximov
- Bu sahifa navigatsiya:
- Davomat oynasi
Quyida cs faylining kod qismi :
using MySql.Data.MySqlClient; 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 Transparent_Form; namespace Olmosiy_System { public partial class MainForm : Form { StudentClass student = new StudentClass(); public MainForm() { InitializeComponent(); customizeDesing(); } private void panel_stdsubmenu_Paint(object sender, PaintEventArgs e) { } private void Form1_Load(object sender, EventArgs e) { studentCount(); { private void studentCount() { label_totalStd.Text = "Total Students : " + student.totalStudent(); label_malestd.Text = "Male : " + student.maleStudent(); label_femalestd.Text = "Female : " + student.femaleStudent(); } private void customizeDesing() { panel_stdsubmenu.Visible = false; panel_coursesubMenu.Visible = false; panel_scoreSubmenu.Visible = false; } private void hidesubmenu(){ if (panel_stdsubmenu.Visible == true) panel_stdsubmenu.Visible = false; if (panel_coursesubMenu.Visible == true) panel_coursesubMenu.Visible = false; if (panel_scoreSubmenu.Visible == true) panel_scoreSubmenu.Visible = false; } private void showSubmenu(Panel submenu) { if (submenu.Visible == false) { hidesubmenu(); submenu.Visible = true; } else submenu.Visible = false; } private void button_std_Click(object sender, EventArgs e) { showSubmenu(panel_stdsubmenu); } #region stdsubmenu private void button_registration_Click(object sender, EventArgs e) { openChildForm(new RegistrationForm()); hidesubmenu();} private void button_manegeStd_Click(object sender, EventArgs e) { openChildForm(new Status()); hidesubmenu(); } private void button_Status_Click(object sender, EventArgs e) { openChildForm(new Status()); hidesubmenu(); } private void button_stdPrint_Click(object sender, EventArgs e) { hidesubmenu(); } #endregion stdsubmenu private void button5_Click(object sender, EventArgs e) { showSubmenu(panel_coursesubMenu); } #region coursesubmenu private void button_newCourse_Click(object sender, EventArgs e) { openChildForm(new Status()); hidesubmenu();} private void button_ManegeCourse_Click(object sender, EventArgs e) { hidesubmenu(); } private void button_CoursePrint_Click(object sender, EventArgs e) { hidesubmenu(); } #endregion coursesubmenu private void button_score_Click(object sender, EventArgs e) { showSubmenu(panel_scoreSubmenu); } #region scoresubmenu private void button_AddScore_Click(object sender, EventArgs e) { hidesubmenu(); } private void button_ManageScore_Click(object sender, EventArgs e) { hidesubmenu(); } private void button_ScorePrint_Click(object sender, EventArgs e) { hidesubmenu(); } #endregion scoresubmenu private Form activeForm = null; private void openChildForm(Form childForm) { if (activeForm != null) activeForm.Close(); activeForm = childForm; childForm.TopLevel = false; childForm.FormBorderStyle = FormBorderStyle.None; childForm.Dock = DockStyle.Fill; panel_main.Controls.Add(childForm); panel_main.Tag = childForm; childForm.BringToFront(); childForm.Show(); }
{ if (activeForm != null) activeForm.Close(); panel_main.Controls.Add(panel_cover); } private void comboBox_course_SelectedIndexChanged(object sender, EventArgs e) { label_cmale.Text = "Male : " + student.exeCount("SELECT COUNT(*) FROM student INNER JOIN score ON score.StudentId = student.StdId WHERE score.CourseName = '" + comboBox1.Text + "' AND student.Gender = 'Male'"); label_cFamele.Text = "Female : " + student.exeCount("SELECT COUNT(*) FROM student INNER JOIN score ON score.StudentId = student.StdId WHERE score.CourseName = '" + comboBox1.Text + "' AND student.Gender = 'Female'"); } private void pictureBox1_Click(object sender, EventArgs e) {} private void panel2_Paint(object sender, PaintEventArgs e) {} private void label4_Click(object sender, EventArgs e) {} private void label2_Click(object sender, EventArgs e) {} private void label3_Click(object sender, EventArgs e) {}} Shuni aytib o’tish joizki Davomat tizimini monitoring qolish axborot tizimini loyihalashda foydalanuvchining dasturdan foydalanish jarayonida uni qiyinchiliksiz tushunishi va osson ishlata oladigan qilib yaratilgan. Dasturni asosiy ko’rinishi quyidagicha: 5-rasm ilova oynasi Bu yerda Main Formini kodlari berilgan va form korinishi keying ish bilan Registratsion bolimiga doir ishlarni korib chiqamiz (6 – rasm ) 6-rasm Registration oynasi Ushbu rasmda Registration oynasi ochilgan va tushunish uchun qulay using MySql.Data.MySqlClient; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Transparent_Form; namespace Olmosiy_System { public partial class RegistrationForm : Form { StudentClass student = new StudentClass(); public RegistrationForm() { InitializeComponent(); } bool verify() { if ((TextBox_Fname.Text == "") || (textBox_Lname.Text == "") || (textBox_Tell.Text == "") || (textBox_Adress.Text == "") || (pictureBoxPic.Image == null)) { return false; } else return true;} public void showTable() { guna2DataGridView1.DataSource = student.getStudentlist(new MySqlCommand("SELECT * FROM `student`")); DataGridViewImageColumn imageColumn = new DataGridViewImageColumn(); imageColumn = (DataGridViewImageColumn)guna2DataGridView1.Columns[7]; imageColumn.ImageLayout = DataGridViewImageCellLayout.Zoom; } private void textBox1_TextChanged(object sender, EventArgs e) {} private void label1_Click(object sender, EventArgs e) {} private void radioButton1_CheckedChanged(object sender, EventArgs e){} private void label3_Click(object sender, EventArgs e) {} private void label2_Click(object sender, EventArgs e) {} private void textBox2_TextChanged(object sender, EventArgs e) {} private void panel1_Paint(object sender, PaintEventArgs e){} private void button_Upload_Click(object sender, EventArgs e) { OpenFileDialog opf = new OpenFileDialog(); opf.Filter = "Select Photo(*.jpg;*.png;*.gif)|*.jpg;*.png;*.gif"; if (opf.ShowDialog() == DialogResult.OK) pictureBoxPic.Image = Image.FromFile(opf.FileName); } private void button_Add_Click(object sender, EventArgs e) { string fname = TextBox_Fname.Text; string lname = textBox_Lname.Text; DateTime bdate = dateTimePicker1.Value; string phone = textBox_Tell.Text; string address = textBox_Adress.Text; string gender = radioButton_Male.Checked ? "Erkak" : "Ayol"; int born_year = dateTimePicker1.Value.Year; int this_year = DateTime.Now.Year; if ((this_year - born_year) < 10 || (this_year - born_year) > 100) { MessageBox.Show("Yoshi 10 yoshdan katta 100 yoshdan kichik bo'lishi kerak", "Yaroqsiz tug'ulgan kun", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (verify()) { try{ MemoryStream ms = new MemoryStream(); pictureBoxPic.Image.Save(ms, pictureBoxPic.Image.RawFormat); byte[] img = ms.ToArray(); if (student.insertStudent(fname, lname, bdate, gender, phone, address, img)){ showTable(); MessageBox.Show("Yangi talaba qo'shildi", "Malumotlar", MessageBoxButtons.OK, MessageBoxIcon.Information);}} catch (Exception ex) { MessageBox.Show(ex.Message, "Xato ma'lumot ", MessageBoxButtons.OK, MessageBoxIcon.Error; }} else{ MessageBox.Show("Bo'sh maydon ", "Malumotlar", MessageBoxButtons.OK, MessageBoxIcon.Warning);}} private void button_Clear_Click(object sender, EventArgs e) { TextBox_Fname.Clear(); textBox_Lname.Clear(); textBox_Tell.Clear(); textBox_Adress.Clear(); radioButton_Male.Checked = true; dateTimePicker1.Value = DateTime.Now; pictureBoxPic.Image = null; MessageBox.Show("Yangi ma'lumot kiritish mumkin ", "Tozalash ", MessageBoxButtons.OK, MessageBoxIcon.Warning);} private void guna2DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e){} private void label13_Click(object sender, EventArgs e) {} private void RegistrationForm_Load(object sender, EventArgs e){ showTable(); } private void radioButton3_CheckedChanged(object sender, EventArgs e) {} }} 7 – rasm Davomat oynasi Download 1.64 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling