📄 main.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication3
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel MainPanel;
private System.Windows.Forms.Panel TopPanel;
private System.Windows.Forms.Panel RightPicPanel;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.PictureBox pictureBox5;
protected System.Windows.Forms.PictureBox pictureBox7;
private System.Windows.Forms.PictureBox pictureBox8;
private System.Windows.Forms.FolderBrowserDialog fbd;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.TopPanel = new System.Windows.Forms.Panel();
this.pictureBox8 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox6 = new System.Windows.Forms.PictureBox();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.pictureBox7 = new System.Windows.Forms.PictureBox();
this.MainPanel = new System.Windows.Forms.Panel();
this.RightPicPanel = new System.Windows.Forms.Panel();
this.fbd = new System.Windows.Forms.FolderBrowserDialog();
this.TopPanel.SuspendLayout();
this.SuspendLayout();
//
// TopPanel
//
this.TopPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TopPanel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("TopPanel.BackgroundImage")));
this.TopPanel.Controls.Add(this.pictureBox8);
this.TopPanel.Controls.Add(this.pictureBox1);
this.TopPanel.Controls.Add(this.pictureBox3);
this.TopPanel.Controls.Add(this.pictureBox2);
this.TopPanel.Controls.Add(this.pictureBox6);
this.TopPanel.Controls.Add(this.pictureBox5);
this.TopPanel.Controls.Add(this.pictureBox7);
this.TopPanel.Location = new System.Drawing.Point(0, 0);
this.TopPanel.Name = "TopPanel";
this.TopPanel.Size = new System.Drawing.Size(800, 43);
this.TopPanel.TabIndex = 0;
//
// pictureBox8
//
this.pictureBox8.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox8.BackgroundImage")));
this.pictureBox8.Location = new System.Drawing.Point(360, 0);
this.pictureBox8.Name = "pictureBox8";
this.pictureBox8.Size = new System.Drawing.Size(2, 35);
this.pictureBox8.TabIndex = 9;
this.pictureBox8.TabStop = false;
//
// pictureBox1
//
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(136, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(103, 35);
this.pictureBox1.TabIndex = 6;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click_1);
this.pictureBox1.MouseEnter += new System.EventHandler(this.pictureBox1_MouseEnter);
this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
//
// pictureBox3
//
this.pictureBox3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox3.BackgroundImage")));
this.pictureBox3.Location = new System.Drawing.Point(128, 0);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(2, 35);
this.pictureBox3.TabIndex = 10;
this.pictureBox3.TabStop = false;
//
// pictureBox2
//
this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
this.pictureBox2.Location = new System.Drawing.Point(24, 0);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(103, 35);
this.pictureBox2.TabIndex = 5;
this.pictureBox2.TabStop = false;
this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
this.pictureBox2.MouseEnter += new System.EventHandler(this.pictureBox2_MouseEnter);
this.pictureBox2.MouseLeave += new System.EventHandler(this.pictureBox2_MouseLeave);
//
// pictureBox6
//
this.pictureBox6.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox6.BackgroundImage")));
this.pictureBox6.Location = new System.Drawing.Point(248, 0);
this.pictureBox6.Name = "pictureBox6";
this.pictureBox6.Size = new System.Drawing.Size(2, 35);
this.pictureBox6.TabIndex = 11;
this.pictureBox6.TabStop = false;
//
// pictureBox5
//
this.pictureBox5.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox5.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox5.Image")));
this.pictureBox5.Location = new System.Drawing.Point(368, 0);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(131, 35);
this.pictureBox5.TabIndex = 7;
this.pictureBox5.TabStop = false;
this.pictureBox5.Click += new System.EventHandler(this.pictureBox5_Click);
this.pictureBox5.MouseEnter += new System.EventHandler(this.pictureBox5_MouseEnter);
this.pictureBox5.MouseLeave += new System.EventHandler(this.pictureBox5_MouseLeave);
//
// pictureBox7
//
this.pictureBox7.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox7.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox7.Image")));
this.pictureBox7.Location = new System.Drawing.Point(256, 0);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(103, 35);
this.pictureBox7.TabIndex = 8;
this.pictureBox7.TabStop = false;
this.pictureBox7.Click += new System.EventHandler(this.pictureBox7_Click);
this.pictureBox7.MouseEnter += new System.EventHandler(this.pictureBox7_MouseEnter);
this.pictureBox7.MouseLeave += new System.EventHandler(this.pictureBox7_MouseLeave);
//
// MainPanel
//
this.MainPanel.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.MainPanel.Location = new System.Drawing.Point(0, 48);
this.MainPanel.Name = "MainPanel";
this.MainPanel.Size = new System.Drawing.Size(608, 456);
this.MainPanel.TabIndex = 1;
//
// RightPicPanel
//
this.RightPicPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.RightPicPanel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("RightPicPanel.BackgroundImage")));
this.RightPicPanel.Location = new System.Drawing.Point(608, 40);
this.RightPicPanel.Name = "RightPicPanel";
this.RightPicPanel.Size = new System.Drawing.Size(184, 472);
this.RightPicPanel.TabIndex = 2;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(792, 509);
this.Controls.Add(this.RightPicPanel);
this.Controls.Add(this.MainPanel);
this.Controls.Add(this.TopPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "湖北省高等学校毕业生就业指导中心";
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
this.Load += new System.EventHandler(this.Form1_Load);
this.TopPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
Form2 frmLogin = new Form2();
if (frmLogin.ShowDialog() == DialogResult.Cancel)
{
this.Close( );
}
else
{
if ( Config.HasSet( ) )
{
MainPanel.Controls.Clear();
InputData inputDat = new InputData();
inputDat.Dock = DockStyle.Fill;
RightPicPanel.BackgroundImage = Image.FromFile( "img\\bg01.GIF" );
MainPanel.Controls.Add(inputDat);
}
else
{
MessageBox.Show( "请先设置源数据库位置!","出错信息",MessageBoxButtons.OK ,MessageBoxIcon.Warning );
if ( fbd.ShowDialog( ) == DialogResult.OK )
{
Config.SetPath ( fbd.SelectedPath );
MainPanel.Controls.Clear();
InputData inputDat = new InputData();
inputDat.Dock = DockStyle.Fill;
RightPicPanel.BackgroundImage = Image.FromFile( "img\\bg01.GIF" );
MainPanel.Controls.Add(inputDat);
}
else
{
MessageBox.Show( "你还没有设置源数据库位置!不可以进行查询,请退出重新登陆设置" );
}
}
}
}
private void tp1_Click(object sender, System.EventArgs e)
{
}
private void pictureBox1_Click(object sender, System.EventArgs e)
{
MainPanel.Controls.Clear();
InputData inputDat = new InputData();
inputDat.Dock = DockStyle.Fill;
RightPicPanel.BackgroundImage = Image.FromFile( "img\\bg01.GIF" );
MainPanel.Controls.Add(inputDat);
}
private void picOfEdit_Click(object sender, System.EventArgs e)
{
// MainPanel.Controls.Clear();
// EditInformation inputDat = new EditInformation();
// inputDat.Dock = DockStyle.Fill;
// RightPicPanel.BackgroundImage = Image.FromFile( "..\\..\\img\\bg03.GIF" );
// MainPanel.Controls.Add(inputDat);
MainPanel.Controls.Clear( );
QueryByNewData query = new QueryByNewData( );
query.Dock = DockStyle.Fill;
MainPanel.Controls.Add(query);
}
private void picOfQuery_Click(object sender, System.EventArgs e)
{
MainPanel.Controls.Clear();
Query inputDat = new Query();
inputDat.Dock = DockStyle.Fill;
RightPicPanel.BackgroundImage = Image.FromFile( "img\\bg02.GIF" );
MainPanel.Controls.Add(inputDat);
}
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.Dispose( );
}
private void pictureBox2_MouseEnter(object sender, System.EventArgs e)
{
pictureBox2.Image = Image.FromFile( "img\\录入信息2.GIF" );
}
private void pictureBox1_MouseEnter(object sender, System.EventArgs e)
{
pictureBox1.Image = Image.FromFile( "img\\旧库查询2.GIF" );
}
private void pictureBox2_MouseLeave(object sender, System.EventArgs e)
{
pictureBox2.Image = Image.FromFile( "img\\录入信息1.GIF" );
}
private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
{
pictureBox1.Image = Image.FromFile( "img\\旧库查询1.GIF" );
}
private void pictureBox7_MouseEnter(object sender, System.EventArgs e)
{
pictureBox7.Image = Image.FromFile( "img\\新库查询2.GIF" );
}
private void pictureBox7_MouseLeave(object sender, System.EventArgs e)
{
pictureBox7.Image = Image.FromFile( "img\\新库查询1.GIF" );
}
private void pictureBox5_MouseEnter(object sender, System.EventArgs e)
{
pictureBox5.Image = Image.FromFile( "img\\用户信息管理2.GIF" );
}
private void pictureBox5_MouseLeave(object sender, System.EventArgs e)
{
pictureBox5.Image = Image.FromFile( "img\\用户信息管理1.GIF" );
}
private void pictureBox2_Click(object sender, System.EventArgs e)
{
MainPanel.Controls.Clear();
InputData inputDat = new InputData();
inputDat.Dock = DockStyle.Fill;
RightPicPanel.BackgroundImage = Image.FromFile( "img\\bg01.GIF" );
MainPanel.Controls.Add(inputDat);
}
private void pictureBox1_Click_1(object sender, System.EventArgs e)
{
MainPanel.Controls.Clear();
Query inputDat = new Query();
inputDat.Dock = DockStyle.Fill;
RightPicPanel.BackgroundImage = Image.FromFile( "img\\bg02.GIF" );
MainPanel.Controls.Add(inputDat);
}
private void pictureBox5_Click(object sender, System.EventArgs e)
{
MainPanel.Controls.Clear();
EditInformation inputDat = new EditInformation();
inputDat.Dock = DockStyle.Fill;
RightPicPanel.BackgroundImage = Image.FromFile( "img\\bg03.GIF" );
MainPanel.Controls.Add(inputDat);
}
private void pictureBox7_Click(object sender, System.EventArgs e)
{
MainPanel.Controls.Clear();
QueryByNewData inputDat = new QueryByNewData();
inputDat.Dock = DockStyle.Fill;
RightPicPanel.BackgroundImage = Image.FromFile( "img\\bg02.GIF" );
MainPanel.Controls.Add(inputDat);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -