winform关闭当前form_C#之WinForm的代码 点击button关闭当前窗体,用this.close()

镇场诗:慈心与积善,以有为入无为。学术有小成,特来此分享。诚心说愿望,愿见文者的利益。

//

form1的布局,

解决方案资源管理器,

form1.cs

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 WindowsFormsApplication3

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

}

private void button1_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

program.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WindowsFormsApplication3

{

static class Program

{

///

/// 应用程序的主入口点。

///

[STAThread]

static void Main()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new Form1());

}

}

} // 感恩所有帮我的人。实践,才有真本事。如果您觉得对您有帮助就点赞,不好就差评。因为我要及时删除一些没有帮助的博文,提高自己的博文质量。O(∩_∩)O谢谢 若有可改进与错误之处,请留言。 2016-07-31 只有代码,没有效果图。所以加效果图! 注:此文仅作为科学研究。如果我侵犯了您的权益,请告知。看到您的告知后,我将及时作出处理。

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值