Beispiel #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveINI = new SaveFileDialog();

            saveINI.Filter = "INI File |*.ini";
            if (saveINI.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                inifile ini = new inifile(saveINI.FileName);
                ini.Write("Button", "Value_button1", button1.Text);
                int p;
                for (p = 0; p < richTextBox1.Lines.Length; p++)
                {
                    ini.Write("richTextBox1", Convert.ToString(p), richTextBox1.Lines[p].ToString());
                }
                int p1;
                for (p1 = 0; p1 < richTextBox1.Lines.Length; p1++)
                {
                    ini.Write("richTextBox2", Convert.ToString(p1), richTextBox2.Lines[p1].ToString());
                }
                ini.Write("richTextBox1", "NumStr", Convert.ToString(p));
                ini.Write("richTextBox2", "NumStr2", Convert.ToString(p1));
                ini.Write("Button", "Value_button2", button2.Text);
                ini.Write("Button", "Value_button1_color", button1.BackColor.ToString());
                ini.Write("Button", "Value_button2_color", button2.BackColor.ToString());
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog o1 = new OpenFileDialog();

            o1.Filter = "INI File |*.ini";
            if (o1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                inifile ini    = new inifile(o1.FileName);
                string  ini0   = ini.ReadINI("richTextBox1", "NumStr");
                string  ini00  = ini.ReadINI("richTextBox2", "NumStr2");
                string  ini1   = ini.ReadINI("Button", "Value_button1");
                int     NumStr = Convert.ToInt32(ini0);
                for (int p = 0; p < NumStr; p++)
                {
                    string ini2 = ini.ReadINI("richTextBox1", Convert.ToString(p));
                    richTextBox1.Text += ini2 + Environment.NewLine;
                }
                int NumStr2 = Convert.ToInt32(ini00);
                for (int p = 0; p < NumStr; p++)
                {
                    string ini22 = ini.ReadINI("richTextBox2", Convert.ToString(p));
                    richTextBox2.Text += ini22 + Environment.NewLine;
                }
                string ini3 = ini.ReadINI("Button", "Value_button2");
                string ini4 = ini.ReadINI("Button", "Value_button1_color");
                string ini5 = ini.ReadINI("Button", "Value_button2_color");
                button1.Text = ini1;
                button2.Text = ini3;
                Color color2 = Color.FromName(ini5);
                Color color1 = Color.FromName(ini4);
                button1.BackColor = color1;
                button2.BackColor = color2;
            }
        }