📄 mainform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;//调用外部非托管DLL用
using System.Configuration;//读配置文件
using System.Text;
using System.Data.SqlClient;
namespace Communication_Statistics
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.ComboBox Area_Name_list;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox BaseImportPath;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox opera_name_list;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button Browse01;
private System.Windows.Forms.Button ImportBut01;
private System.Windows.Forms.TextBox ClassImportPath;
private System.Windows.Forms.Button ImportBut02;
private System.Windows.Forms.Button Browse02;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label area_code;
public string currentpath=Environment.CurrentDirectory+"\\setup.ini";
//--------------申明对ini文件的读写操作!
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section,
string key,string val,string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,
string key,string def, StringBuilder retVal,
int size,string filePath);
public void IniWriteValue(string Section,string Key,string Value,string filepath)//对ini文件进行写操作的函数
{
WritePrivateProfileString(Section,Key,Value,filepath);
}
public string IniReadValue(string Section,string Key,string filepath)//对ini文件进行读操作的函数
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section,Key,"",temp,
255, filepath);
return temp.ToString();
}
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()
{
this.Area_Name_list = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.Browse01 = new System.Windows.Forms.Button();
this.ImportBut01 = new System.Windows.Forms.Button();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.BaseImportPath = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.opera_name_list = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.ClassImportPath = new System.Windows.Forms.TextBox();
this.ImportBut02 = new System.Windows.Forms.Button();
this.Browse02 = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.area_code = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// Area_Name_list
//
this.Area_Name_list.Items.AddRange(new object[] {
"蔡甸",
"东西湖",
"新洲",
"汉南",
"黄陂",
"江夏",
"汉阳",
"洪山",
"江岸",
"江汉",
"青山",
"武昌",
"手机俱乐部",
"大客户"});
this.Area_Name_list.Location = new System.Drawing.Point(96, 28);
this.Area_Name_list.Name = "Area_Name_list";
this.Area_Name_list.Size = new System.Drawing.Size(120, 20);
this.Area_Name_list.TabIndex = 0;
this.Area_Name_list.SelectedIndexChanged += new System.EventHandler(this.Area_Name_list_SelectedIndexChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(15, 35);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 16);
this.label1.TabIndex = 1;
this.label1.Text = "请选择区域:";
//
// Browse01
//
this.Browse01.Location = new System.Drawing.Point(223, 80);
this.Browse01.Name = "Browse01";
this.Browse01.Size = new System.Drawing.Size(56, 23);
this.Browse01.TabIndex = 2;
this.Browse01.Text = "浏览";
this.Browse01.Click += new System.EventHandler(this.Browse01_Click);
//
// ImportBut01
//
this.ImportBut01.Location = new System.Drawing.Point(215, 19);
this.ImportBut01.Name = "ImportBut01";
this.ImportBut01.Size = new System.Drawing.Size(56, 23);
this.ImportBut01.TabIndex = 3;
this.ImportBut01.Text = "导入";
this.ImportBut01.Click += new System.EventHandler(this.ImportBut01_Click);
//
// BaseImportPath
//
this.BaseImportPath.Location = new System.Drawing.Point(95, 81);
this.BaseImportPath.Name = "BaseImportPath";
this.BaseImportPath.Size = new System.Drawing.Size(121, 21);
this.BaseImportPath.TabIndex = 6;
this.BaseImportPath.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 85);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 23);
this.label4.TabIndex = 7;
this.label4.Text = "文本路径:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.area_code);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.ImportBut01);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(280, 104);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "基础数据";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.ImportBut02);
this.groupBox2.Controls.Add(this.Browse02);
this.groupBox2.Location = new System.Drawing.Point(8, 118);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(280, 80);
this.groupBox2.TabIndex = 9;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "分业务的数据";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 26);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 16);
this.label2.TabIndex = 10;
this.label2.Text = "请选择业务:";
//
// opera_name_list
//
this.opera_name_list.Items.AddRange(new object[] {
"蔡甸",
"东西湖",
"新洲",
"汉南",
"黄陂",
"江夏",
"汉阳",
"洪山",
"江岸",
"江汉",
"青山",
"武昌",
"手机俱乐部",
"大客户"});
this.opera_name_list.Location = new System.Drawing.Point(96, 138);
this.opera_name_list.Name = "opera_name_list";
this.opera_name_list.Size = new System.Drawing.Size(120, 20);
this.opera_name_list.TabIndex = 10;
//
// label3
//
this.label3.Location = new System.Drawing.Point(9, 50);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(72, 23);
this.label3.TabIndex = 11;
this.label3.Text = "文本路径:";
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -