[c#]:如何在C#中读写INI文件(三)

using System ;

using System.Drawing ;

using System.Collections ;

using System.ComponentModel ;

using System.Windows.Forms ;

using System.Data ;

using System.Runtime.InteropServices ;

using System.Text ;

namespace C_操作INI文件__写操作

{

        public class Form1 : System.Windows.Forms.Form

        {

               private System.Windows.Forms.Button button1 ;

               private System.Windows.Forms.TextBox textBox1 ;

               private System.Windows.Forms.Button button2 ;

               private System.Windows.Forms.TextBox textBox2 ;

               private System.Windows.Forms.TextBox textBox3 ;

               private System.Windows.Forms.TextBox textBox4 ;

               private System.Windows.Forms.Label label1 ;

               private System.Windows.Forms.Label label2 ;

               private System.Windows.Forms.Label label3 ;

               private System.Windows.Forms.Button button3 ;

               private System.Windows.Forms.OpenFileDialog openFileDialog1 ;

               private System.ComponentModel.Container components = null ;

               public Form1 ( )

               {

                       InitializeComponent ( ) ;

               }

               protected override void Dispose (  bool disposing  )

               {

                       if (  disposing  )

                       {

                               if  ( components != null ) 

                               {

                                      components.Dispose ( ) ;

                               }

                       }

                       base.Dispose (  disposing  ) ;

               }

 

               [ 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 ) ;

               private void InitializeComponent ( )

               {

               this.button1 = new System.Windows.Forms.Button ( ) ;

               this.textBox1 = new System.Windows.Forms.TextBox ( ) ;

               this.button2 = new System.Windows.Forms.Button ( ) ;

               this.textBox2 = new System.Windows.Forms.TextBox ( ) ;

               this.textBox3 = new System.Windows.Forms.TextBox ( ) ;

               this.textBox4 = new System.Windows.Forms.TextBox ( ) ;

               this.label1 = new System.Windows.Forms.Label ( ) ;

               this.label2 = new System.Windows.Forms.Label ( ) ;

               this.label3 = new System.Windows.Forms.Label ( ) ;

               this.button3 = new System.Windows.Forms.Button ( ) ;

               this.openFileDialog1 = new

System.Windows.Forms.OpenFileDialog ( ) ;

                       this.SuspendLayout ( ) ;

        this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat ;

        this.button1.Location = new System.Drawing.Point ( 238 , 20 ) ;

        this.button1.Name = "button1" ;

        this.button1.Size = new System.Drawing.Size ( 100 , 32 ) ;

        this.button1.TabIndex = 0 ;

        this.button1.Text = "选择INI文件" ;

        this.button1.Click += new System.EventHandler ( this.button1_Click ) ;

        this.textBox1.Location = new System.Drawing.Point ( 58 , 22 ) ;

        this.textBox1.Name = "textBox1" ;

        this.textBox1.Size = new System.Drawing.Size ( 162 , 21 ) ;

        this.textBox1.TabIndex = 1 ;

        this.textBox1.Text = "" ;

        this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat ;

        this.button2.Location = new System.Drawing.Point ( 86 , 168 ) ;

        this.button2.Name = "button2" ;

        this.button2.Size = new System.Drawing.Size ( 98 , 30 ) ;

 

  • 0
    点赞
  • 0
    收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
评论

打赏作者

chenyu001

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值