using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
namespace
Test1
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
string
filename =
null
;
private
void
Form1_Load(
object
sender, EventArgs e)
{
filename = Application.StartupPath +
"\\Config.ini"
;
}
/// <summary>
/// 读取
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
Button_Read_Click(
object
sender, EventArgs e)
{
string
names = IniFunc.getString(
"Information"
,
"Name"
,
null
, filename);
string
gender = IniFunc.getString(
"Information"
,
"Gender"
,
null
, filename);
string
age = IniFunc.getString(
"Information"
,
"Age"
,
null
, filename);
string
region = IniFunc.getString(
"Information"
,
"Region"
,
null
, filename);
TextBox_Name.Text = names;
TextBox_Gender.Text = gender;
TextBox_Age.Text = age;
TextBox_Region.Text = region;
}
/// <summary>
/// 写入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
Button_Write_Click(
object
sender, EventArgs e)
{
string
names = TextBox_Name.Text;
string
gender = TextBox_Gender.Text;
string
age = TextBox_Age.Text;
string
region = TextBox_Region.Text;
IniFunc.writeString(
"Information"
,
"Name"
, names, filename);
IniFunc.writeString(
"Information"
,
"Gender"
, gender, filename);
IniFunc.writeString(
"Information"
,
"Age"
, age, filename);
IniFunc.writeString(
"Information"
,
"Region"
, region, filename);
}
/// <summary>
/// 清空
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
Button_Clear_Click(
object
sender, EventArgs e)
{
TextBox_Name.Text =
string
.Empty;
TextBox_Gender.Text =
string
.Empty;
TextBox_Age.Text =
string
.Empty;
TextBox_Region.Text =
string
.Empty;
}
}
}