using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace IniFiles { public partial class Form1 : Form { IniFile INI = new IniFile("config.ini"); public Form1() { InitializeComponent(); auto_read(); } private void auto_read() { if (INI.KeyExistsINI("SettingForm1", "Width")) numericUpDown2.Value = int.Parse(INI.ReadINI("SettingForm1", "Height")); else numericUpDown1.Value = this.MinimumSize.Height; if (INI.KeyExistsINI("SettingForm1", "Height")) numericUpDown1.Value = int.Parse(INI.ReadINI("SettingForm1", "Width")); else numericUpDown2.Value = this.MinimumSize.Width; if (INI.KeyExistsINI("SettingForm1", "Width")) textBox1.Text = INI.ReadINI("Other", "Text"); this.Height = int.Parse(numericUpDown1.Value.ToString()); this.Width = int.Parse(numericUpDown2.Value.ToString()); } private void button1_Click(object sender, EventArgs e) { INI.WriteINI("SettingForm1", "Height", numericUpDown2.Value.ToString()); INI.WriteINI("SettingForm1", "Width", numericUpDown1.Value.ToString()); INI.WriteINI("Other", "Text", textBox1.Text); MessageBox.Show(" SettingForm1 Other ", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);