using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace work_VCnet
{
///
<summary>
///
Summary description for mainform.
///
</summary>
public
class
mainform : System.Windows.Forms.Form
{
internal
System.Windows.Forms.MenuItem Menuline2;
internal
System.Windows.Forms.MenuItem Menuintroductory;
internal
System.Windows.Forms.MenuItem Menuabout;
internal
System.Windows.Forms.MenuItem Menuexit;
internal
System.Windows.Forms.MenuItem Menuquit;
internal
System.Windows.Forms.MenuItem Menuline3;
internal
System.Windows.Forms.MenuItem Menuline1;
internal
System.Windows.Forms.MenuItem Menutools;
internal
System.Windows.Forms.MenuItem Menubooknote;
internal
System.Windows.Forms.MenuItem Menuagenda;
internal
System.Windows.Forms.MenuItem Menucal;
internal
System.Windows.Forms.Timer Timer1;
internal
System.Windows.Forms.Panel Panel1;
internal
System.Windows.Forms.Button Btntools;
internal
System.Windows.Forms.Panel Panel11;
internal
System.Windows.Forms.PictureBox Pic_about;
internal
System.Windows.Forms.PictureBox Pic_intro;
internal
System.Windows.Forms.PictureBox Pic_agenda;
internal
System.Windows.Forms.PictureBox Pic_booknote;
internal
System.Windows.Forms.PictureBox Pic_calculator;
internal
System.Windows.Forms.Label lblb;
internal
System.Windows.Forms.Label Lrbt;
internal
System.Windows.Forms.ImageList ImageList1;
internal
System.Windows.Forms.ToolBarButton ToolBarButton10;
internal
System.Windows.Forms.ToolBarButton ToolBarButton11;
internal
System.Windows.Forms.ToolBarButton ToolBarButton8;
internal
System.Windows.Forms.ToolBarButton ToolBarButton9;
internal
System.Windows.Forms.ToolBarButton ToolBarButton12;
internal
System.Windows.Forms.ToolBarButton ToolBarButton15;
internal
System.Windows.Forms.ToolBarButton ToolBarButton13;
internal
System.Windows.Forms.ToolBarButton ToolBarButton14;
internal
System.Windows.Forms.ToolBarButton ToolBarButton1;
internal
System.Windows.Forms.ToolBarButton ToolBarButton2;
internal
System.Windows.Forms.MainMenu MainMenu1;
internal
System.Windows.Forms.ToolBar ToolBar1;
internal
System.Windows.Forms.ToolBarButton ToolBarButton3;
internal
System.Windows.Forms.ToolBarButton ToolBarButton4;
internal
System.Windows.Forms.ToolBarButton ToolBarButton5;
internal
System.Windows.Forms.ToolBarButton ToolBarButton6;
internal
System.Windows.Forms.ToolBarButton ToolBarButton7;
private
System.ComponentModel.IContainer components;
//variable
System.Windows.Forms.DialogResult
response;
string
msg_inf;
private
System.Windows.Forms.Label ltimer;
bool
flg_close;
public
mainform()
{
//
// Required for
Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any
constructor code after InitializeComponent call
//
}
///
<summary>
///
Clean up any resources being used.
///
</summary>
protected
override
void
Dispose( bool
disposing )
{
if(
disposing )
{
if
(components != null)
{
components.Dispose();
}
}
base.Dispose(
disposing );
}
Windows Form
Designer generated
code |
public class
mainform_cl
{
public static string
Title = "work .net application, Message";
//cuurent directory
public static string
current_path = "C:\\work_VCnet";
}
private void
mainform_Load(object sender, System.EventArgs e)
{
int var;
//resize
this.Lrbt.Left =
this.ToolBar1.Width - (this.Lrbt.Width + 30);
this.Lrbt.Top = 2;
this.ltimer.Left =
this.Lrbt.Left + ((this.Lrbt.Width - this.ltimer.Width) /
2);
this.ltimer.Top =
this.Lrbt.Top + this.Lrbt.Height;
this.lblb.Width =
this.Panel1.Width / 5;
this.lblb.Left = 4;
this.lblb.Top =
this.ToolBar1.Top + this.ToolBar1.Height + 6;
this.Panel1.Left =
this.lblb.Left;
this.Panel1.Top =
this.lblb.Top;
this.Panel1.Height =
this.Height - (this.ToolBar1.Height * 6 / 2);
this.Panel11.Width =
this.Panel1.Width;
this.Btntools.Width =
this.Panel11.Width;
this.Panel11.Height =
this.Panel1.Height - (this.Btntools.Height * 1) + 8;
this.Panel11.Left = 0;
this.Pic_booknote.Left =
this.Pic_calculator.Left;
this.Pic_agenda.Left =
this.Pic_calculator.Left;
this.Pic_intro.Left =
this.Pic_calculator.Left;
this.Pic_about.Left =
this.Pic_about.Left;
var =
(this.Panel11.Height - (this.Pic_calculator.Height * 5)) /
7;
this.Pic_calculator.Top
= var;
this.Pic_booknote.Top =
this.Pic_calculator.Top + this.Pic_calculator.Height + var;
this.Pic_agenda.Top =
this.Pic_booknote.Top + this.Pic_booknote.Height + var;
this.Pic_intro.Top =
this.Pic_agenda.Top + this.Pic_agenda.Height + var;
this.Pic_about.Top =
this.Pic_intro.Top + this.Pic_intro.Height + var;
this.Lrbt.Visible =
true;
this.ltimer.Visible =
true;
flg_close = true;
}
private void
mainform_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
if (flg_close == true)
{
msg_inf = "are you sure
want to exit Work .net";
response =
MessageBox.Show(msg_inf,
work_VCnet.mainform.mainform_cl.Title,
MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Information );
flg_close = false;
}
if (response ==
DialogResult.Yes)
{
Application.Exit();
}
if (response ==
DialogResult.No)
{
e.Cancel = true;
flg_close = true;
}
}
private void
mainform_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
this.Panel1.Visible =
false;
}
private void
Menuquit_Click(object sender, System.EventArgs e)
{
sub_close();
}
private void sub_close()
{
if (flg_close == true)
{
msg_inf = "are you sure
want to exit Work .net";
response =
MessageBox.Show(msg_inf,
work_VCnet.mainform.mainform_cl.Title,
MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Information );
flg_close = false;
}
if (response ==
DialogResult.Yes)
{
Application.Exit();
}
if (response ==
DialogResult.No)
{
flg_close = true;
}
}
private void
Timer1_Tick(object sender, System.EventArgs e)
{
// Time ...
this.ltimer.Text =
System.DateTime.Now.ToLongTimeString();
}
private void
lblb_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
this.Panel1.Visible =
true;
Sub_Top1();
}
private void Sub_Top1()
{
this.Panel11.Visible =
true;
this.Btntools.Top = 4;
}
private void
Btntools_Click(object sender, System.EventArgs e)
{
Sub_Top1();
}
private void
Menubooknote_Click(object sender, System.EventArgs e)
{
sub_booknote();
}
private void
sub_booknote()
{
book_note Fbook_note =
new book_note();
Fbook_note.Show();
}
private void
Menuagenda_Click(object sender, System.EventArgs e)
{
sub_agenda();
}
private void sub_agenda()
{
agenda Fagenda = new
agenda();
Fagenda.Show();
}
private void
Menucal_Click(object sender, System.EventArgs e)
{
sub_calculator();
}
private void
sub_calculator()
{
calculator Fcalculator =
new calculator();
Fcalculator.Show();
}
private void
Menuintroductory_Click(object sender, System.EventArgs e)
{
sub_intro();
}
private void sub_intro()
{
introductory Fintro =
new introductory();
Fintro.Show();
}
private void
Menuabout_Click(object sender, System.EventArgs e)
{
sub_about();
}
private void sub_about()
{
about Fabout = new
about();
Fabout.Show();
}
private void
ToolBar1_ButtonClick(object sender,
System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
switch(this.ToolBar1.Buttons.IndexOf(e.Button))
{
//calculator
case 2:
sub_calculator();
break;
//Book note
case 5:
sub_booknote();
break;
//agenda
case 8:
sub_agenda();
break;
//introductory
case 11:
sub_intro();
break;
//about
case 14:
sub_about();
break;
}
}
private void
Pic_calculator_Click(object sender, System.EventArgs e)
{
sub_calculator();
}
private void
Pic_booknote_Click(object sender, System.EventArgs e)
{
sub_booknote();
}
private void
Pic_agenda_Click(object sender, System.EventArgs e)
{
sub_agenda();
}
private void
Pic_intro_Click(object sender, System.EventArgs e)
{
sub_intro();
}
private void
Pic_about_Click(object sender, System.EventArgs e)
{
sub_about();
}
}
}
|