Đây là màn hình chính của chương trình, nó sẽ chứa các biểu tượng liên kết tới các màn hình khác trong phần mềm bao gồm: màn hình Tra cứu, Hóa học vui, Trắc nghiệm, Clip hóa học. Với yêu cầu như vậy, chúng tôi đã thiết kế mã nguồn như sau: using System;
using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DictionaryProject.Ultility; using DictionaryProject.DTO; namespace DictionaryProject {
public partial class frmWelcome : Form {
private MainDictionary m_mainDictionary;
private Bitmap m_bmpFrmBack = new Bitmap(@"Image\Welcome.bmp"); public frmWelcome()
{
InitializeComponent(); }
public frmWelcome(MainDictionary mainDic) {
// TODO: Complete member initialization InitializeComponent(); BitmapRegion.CreateControlRegion(this, m_bmpFrmBack); this.m_mainDictionary = mainDic; this.BackgroundImage = m_mainDictionary.imgBackGround_Welcome; picDicIcon.Image = m_mainDictionary.imgDicIconSmall; picHHVIcon.Image = m_mainDictionary.imgHHVIconSmall; picTesIcon.Image = m_mainDictionary.imgTestIconSmall; //picHelpIcon.Image = m_mainDictionary.imgHelpIconSmall; picVideoIcon.Image = m_mainDictionary.imgVideoIconSmall; picButtonDic.Image = m_mainDictionary.imgDicMenu; picButttonHHV.Image = m_mainDictionary.imgHHVMenu; picButtonTest.Image = m_mainDictionary.imgTestMenu; //picButtonHelp.Image = m_mainDictionary.imgHelpMenu; picButtonVideo.Image = m_mainDictionary.imgVideoMenu; setMusicIcon(); }
private void picButtonClose_Nhấp chuột(object sender, EventArgs e) {
this.Close(); }
private void picButtonTest_Nhấp chuột(object sender, EventArgs e) {
openTestDialog(); }
private void openTestDialog() {
this.Hide();
frmTracNghiem frmTest = new frmTracNghiem(m_mainDictionary); frmTest.ShowDialog();
this.Show(); }
private void picButttonHHV_Nhấp chuột(object sender, EventArgs e) {
openHHVDialog(); }
private void openHHVDialog() {
this.Hide();
bool bFullScreen = false;
frmHoaHocVui frmHHV = new frmHoaHocVui(bFullScreen, m_mainDictionary); if (frmHHV.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) {
this.Close(); }
{
this.Show(); }
}
private void picButtonHelp_Nhấp chuột(object sender, EventArgs e) {
//this.Hide();
//MessageBox.Show("Help đang xây dựng", "Thông báo");
//this.Show(); openHelp(); }
private void picButtonContact_Nhấp chuột(object sender, EventArgs e) {
openContact(); }
private void openContact() {
frmLienHe frm = new frmLienHe(m_mainDictionary.imgBackGround_Contact); frm.Show();
}
private void picButtonDic_Nhấp chuột(object sender, EventArgs e) {
openDictionaryDialog(); }
private void openDictionaryDialog() {
this.Hide();
frmDictionary frmDic = new frmDictionary(m_mainDictionary); frmDic.ShowDialog();
this.Show(); }
private void picDicIcon_Nhấp chuột(object sender, EventArgs e) {
openDictionaryDialog(); }
private void picHHVIcon_Nhấp chuột(object sender, EventArgs e) {
openHHVDialog(); }
private void picTesIcon_Nhấp chuột(object sender, EventArgs e) {
openTestDialog(); }
private void picHelpIcon_Nhấp chuột(object sender, EventArgs e) {
openHelp(); }
private static void openHelp() {
System.Diagnostics.Process.Start(ConstantDTO.g_FileHelp); }
private void picContactIcon_Nhấp chuột(object sender, EventArgs e) {
openContact(); }
private void picButtonDic_MouseHover(object sender, EventArgs e) {
picButtonDic.Image = m_mainDictionary.imgDicMenuActive; }
private void picButtonDic_MouseLeave(object sender, EventArgs e) {
picButtonDic.Image = m_mainDictionary.imgDicMenu; }
private void picButttonHHV_MouseHover(object sender, EventArgs e) {
picButttonHHV.Image = m_mainDictionary.imgHHVMenuActive; }
private void picButttonHHV_MouseLeave(object sender, EventArgs e) {
picButttonHHV.Image = m_mainDictionary.imgHHVMenu; }
private void picButtonTest_MouseHover(object sender, EventArgs e) {
picButtonTest.Image = m_mainDictionary.imgTestMenuActive; }
private void picButtonTest_MouseLeave(object sender, EventArgs e) {
picButtonTest.Image = m_mainDictionary.imgTestMenu; }
private void picMusic_Nhấp chuột(object sender, EventArgs e) { if (m_mainDictionary.m_BgMusicOn) { m_mainDictionary.m_BgMusicOn = false; m_mainDictionary.StopMusic(); } else { m_mainDictionary.m_BgMusicOn = true; m_mainDictionary.PlayMusic(); } setMusicIcon(); }
private void setMusicIcon() { if (m_mainDictionary.m_BgMusicOn) { picMusic.Image = m_mainDictionary.imgMusicOn; } else { picMusic.Image = m_mainDictionary.imgMusicOff; } }
private void picButtonVideo_Nhấp chuột(object sender, EventArgs e) {
this.Hide();
frmVideo frm = new frmVideo(m_mainDictionary); frm.ShowDialog();
this.Show(); }
private void picButtonVideo_MouseHover(object sender, EventArgs e) {
picButtonVideo.Image = m_mainDictionary.imgVideoMenuActive; }
private void picButtonVideo_MouseLeave(object sender, EventArgs e) {
picButtonVideo.Image = m_mainDictionary.imgVideoMenu; }
} }