📄 考勤备份.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Data;
using System.Data.SqlClient;
namespace WindowsApplication
{
public class 考勤备份 : System.Windows.Forms.Form
{
#region Control...
private System.Windows.Forms.Label TitleLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textPath;
private System.Windows.Forms.Button btnBrowser;
private System.Windows.Forms.ImageList image;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label userLabel;
private System.Windows.Forms.Label TimeLabel;
private System.Windows.Forms.Timer currentTime;
private System.Windows.Forms.OpenFileDialog openFile;
private System.Windows.Forms.SaveFileDialog saveFile;
private System.ComponentModel.IContainer components;
#endregion
#region Function...
public 考勤备份()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region 变量定义....
private string path=System.Environment.CurrentDirectory.ToString()+"\\KaoQinBack\\back.dll";
#endregion
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(考勤备份));
this.TitleLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.textPath = new System.Windows.Forms.TextBox();
this.btnBrowser = new System.Windows.Forms.Button();
this.image = new System.Windows.Forms.ImageList(this.components);
this.btnOk = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.userLabel = new System.Windows.Forms.Label();
this.TimeLabel = new System.Windows.Forms.Label();
this.currentTime = new System.Windows.Forms.Timer(this.components);
this.openFile = new System.Windows.Forms.OpenFileDialog();
this.saveFile = new System.Windows.Forms.SaveFileDialog();
this.SuspendLayout();
//
// TitleLabel
//
this.TitleLabel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.TitleLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.TitleLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.TitleLabel.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.TitleLabel.ForeColor = System.Drawing.Color.White;
this.TitleLabel.Location = new System.Drawing.Point(0, 0);
this.TitleLabel.Name = "TitleLabel";
this.TitleLabel.Size = new System.Drawing.Size(376, 32);
this.TitleLabel.TabIndex = 0;
this.TitleLabel.Text = "考勤备份";
this.TitleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label1
//
this.label1.ForeColor = System.Drawing.Color.Blue;
this.label1.Location = new System.Drawing.Point(16, 56);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 23);
this.label1.TabIndex = 1;
this.label1.Text = "路径:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textPath
//
this.textPath.BackColor = System.Drawing.Color.White;
this.textPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textPath.ForeColor = System.Drawing.Color.Blue;
this.textPath.Location = new System.Drawing.Point(80, 56);
this.textPath.Name = "textPath";
this.textPath.ReadOnly = true;
this.textPath.Size = new System.Drawing.Size(168, 21);
this.textPath.TabIndex = 2;
this.textPath.Text = "";
//
// btnBrowser
//
this.btnBrowser.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBrowser.ForeColor = System.Drawing.Color.Blue;
this.btnBrowser.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnBrowser.ImageIndex = 1;
this.btnBrowser.ImageList = this.image;
this.btnBrowser.Location = new System.Drawing.Point(272, 56);
this.btnBrowser.Name = "btnBrowser";
this.btnBrowser.Size = new System.Drawing.Size(80, 24);
this.btnBrowser.TabIndex = 3;
this.btnBrowser.Text = "浏览(&B)";
this.btnBrowser.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnBrowser.Click += new System.EventHandler(this.btnBrowser_Click);
this.btnBrowser.MouseEnter += new System.EventHandler(this.button2_MouseEnter);
this.btnBrowser.MouseLeave += new System.EventHandler(this.button2_MouseLeave);
//
// image
//
this.image.ImageSize = new System.Drawing.Size(16, 16);
this.image.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("image.ImageStream")));
this.image.TransparentColor = System.Drawing.Color.Transparent;
//
// btnOk
//
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOk.ForeColor = System.Drawing.Color.Blue;
this.btnOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOk.ImageIndex = 2;
this.btnOk.ImageList = this.image;
this.btnOk.Location = new System.Drawing.Point(168, 104);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(80, 24);
this.btnOk.TabIndex = 4;
this.btnOk.Text = "确定(&O)";
this.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
this.btnOk.MouseEnter += new System.EventHandler(this.button2_MouseEnter);
this.btnOk.MouseLeave += new System.EventHandler(this.button2_MouseLeave);
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.ForeColor = System.Drawing.Color.Blue;
this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button2.ImageIndex = 3;
this.button2.ImageList = this.image;
this.button2.Location = new System.Drawing.Point(272, 104);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 24);
this.button2.TabIndex = 5;
this.button2.Text = "取消(&C)";
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.button2.MouseEnter += new System.EventHandler(this.button2_MouseEnter);
this.button2.MouseLeave += new System.EventHandler(this.button2_MouseLeave);
//
// label2
//
this.label2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label2.Location = new System.Drawing.Point(0, 152);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(376, 32);
this.label2.TabIndex = 6;
//
// userLabel
//
this.userLabel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.userLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.userLabel.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.userLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.userLabel.Location = new System.Drawing.Point(32, 160);
this.userLabel.Name = "userLabel";
this.userLabel.Size = new System.Drawing.Size(144, 23);
this.userLabel.TabIndex = 7;
this.userLabel.Text = "用户名:";
this.userLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// TimeLabel
//
this.TimeLabel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.TimeLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.TimeLabel.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.TimeLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.TimeLabel.Location = new System.Drawing.Point(200, 160);
this.TimeLabel.Name = "TimeLabel";
this.TimeLabel.Size = new System.Drawing.Size(192, 23);
this.TimeLabel.TabIndex = 8;
this.TimeLabel.Text = "当前时间;";
this.TimeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// currentTime
//
this.currentTime.Enabled = true;
this.currentTime.Interval = 1000;
this.currentTime.Tick += new System.EventHandler(this.currentTime_Tick);
//
// saveFile
//
this.saveFile.CheckFileExists = true;
this.saveFile.CreatePrompt = true;
this.saveFile.Filter = "C#文件|*.cs|所有文件|*.*|文本文件|.txt";
this.saveFile.RestoreDirectory = true;
this.saveFile.ShowHelp = true;
//
// 考勤备份
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(374, 179);
this.Controls.Add(this.TimeLabel);
this.Controls.Add(this.userLabel);
this.Controls.Add(this.label2);
this.Controls.Add(this.button2);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnBrowser);
this.Controls.Add(this.textPath);
this.Controls.Add(this.label1);
this.Controls.Add(this.TitleLabel);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "考勤备份";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "考勤备份";
this.Load += new System.EventHandler(this.考勤备份_Load);
this.ResumeLayout(false);
}
#endregion
#region Init Event....
private void 考勤备份_Load(object sender, System.EventArgs e)
{
#region 初始化状态栏信息...
this.userLabel.Text="当前用户:"+landFrame.strUserName;
#endregion
}
#endregion
#region 更改目录...
private void btnBrowser_Click(object sender, System.EventArgs e)
{
this.openFile.InitialDirectory=System.Environment.CurrentDirectory.ToString()+"\\backKaoQin";
this.saveFile.InitialDirectory=System.Environment.CurrentDirectory.ToString()+"\\backKaoQin";
if(this.saveFile.ShowDialog().Equals(DialogResult.Yes))
{
this.textPath.Text=this.openFile.FileName.ToString().Trim();
}
else
{
this.textPath.Text="";
return;
}
}
#endregion
#region 确定事件...
private void btnOk_Click(object sender, System.EventArgs e)
{
}
#endregion
#region 光标移动事件....
private void button2_MouseLeave(object sender, System.EventArgs e)
{
WindowsApplication.MouseStyle.ButtonStyle.MouseLeaved(sender,e);
}
private void button2_MouseEnter(object sender, System.EventArgs e)
{
WindowsApplication.MouseStyle.ButtonStyle.MouseEntered(sender,e);
}
#endregion
#region 当前时间事件...
private void currentTime_Tick(object sender, System.EventArgs e)
{
this.TimeLabel.Text="当前时间:"+WindowsApplication.dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -