• 大小: 40KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-18
  • 语言: C#
  • 标签: 设置  保存  settings  

资源简介

设置 保存 settings C#,简单用法

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TestSettings
{
    public partial class Form1 : Form
    {
        private MainForm maiformSetting = new MainForm();

        public Form1()
        {
            InitializeComponent();

            ReadSetting();
        }

        private void btnSave_Click(object sender EventArgs e)
        {
            maiformSetting.chk1 = this.checkBox1.Checked;

            maiformSetting.chk2 = this.checkBox2.Checked;

            maiformSetting.chk3 = this.checkBox3.Checked;

            maiformSetting.chk4 = this.checkBox4.Checked;

            maiformSetting.Save();
        }

        private void ReadSetting()
        {
            this.checkBox1.Checked = maiformSetting.chk1;

            this.checkBox2.Checked = maiformSetting.chk2;

            this.checkBox3.Checked = maiformSetting.chk3;

            this.checkBox4.Checked = maiformSetting.chk4;

            this.Update();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .CA..H.      8192  2012-03-01 14:17  TestSettings.suo

    .CA....     10752  2012-03-01 14:56  bin\Debug\TestSettings.exe

    .CA....      1134  2012-03-01 14:22  bin\Debug\TestSettings.exe.config

    .CA....     34304  2012-03-01 14:56  bin\Debug\TestSettings.pdb

    .CA....     14328  2012-03-01 14:28  bin\Debug\TestSettings.vshost.exe

    .CA....      1134  2012-03-01 14:22  bin\Debug\TestSettings.vshost.exe.config

    .CA....       653  2012-03-01 14:28  obj\Debug\TestSettings.csproj.FileListAbsolute.txt

    .CA....       847  2012-03-01 14:27  obj\Debug\TestSettings.csproj.GenerateResource.Cache

    .CA....     10752  2012-03-01 14:56  obj\Debug\TestSettings.exe

    .CA....       180  2012-03-01 14:27  obj\Debug\TestSettings.Form1.resources

    .CA....     34304  2012-03-01 14:56  obj\Debug\TestSettings.pdb

    .CA....       180  2012-03-01 14:21  obj\Debug\TestSettings.Properties.Resources.resources

    .CA....      1374  2012-03-01 14:08  Properties\AssemblyInfo.cs

    .CA....      2874  2012-03-01 14:08  Properties\Resources.Designer.cs

    .CA....      5612  2012-03-01 14:08  Properties\Resources.resx

    .CA....      1097  2012-03-01 14:08  Properties\Settings.Designer.cs

    .CA....       249  2012-03-01 14:08  Properties\Settings.settings

    .CA....      1134  2012-03-01 14:22  app.config

    .CA....      1133  2012-03-01 14:52  Form1.cs

    .CA....      4538  2012-03-01 14:27  Form1.Designer.cs

    .CA....      5814  2012-03-01 14:27  Form1.resx

    .CA....      2775  2012-03-01 14:22  MainForm.Designer.cs

    .CA....       782  2012-03-01 14:22  MainForm.settings

    .CA....       473  2012-03-01 14:08  Program.cs

    .CA....      1116  2012-03-01 14:56  SetModel.cs

    .CA....      3843  2012-03-01 14:21  TestSettings.csproj

    .CA....       913  2012-03-01 14:08  TestSettings.sln

    .C.D...         0  2012-03-01 14:15  obj\Debug\Refactor

    .C.D...         0  2012-03-01 14:08  obj\Debug\TempPE

    .C.D...         0  2012-03-01 14:26  bin\Debug

............此处省略7个文件信息

评论

共有 条评论