VC驿站

 找回密码
 加入驿站

QQ登录

只需一步,快速开始

搜索
查看: 464|回复: 0

VS2019 C#明明设置了将上方按钮设为可用却不行

[复制链接]
73_avatar_middle
最佳答案
0 
在线会员 发表于 2020-7-28 13:24:00 | 显示全部楼层 |阅读模式
VS2019 C#明明设置了将上方按钮设为可用却不行

图片:
javascript:;

代码:
Form1:
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 WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            button1.Text = "更改背景颜色";
            button2.Text = "打开进度条窗口";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                this.BackColor = colorDialog1.Color;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form2 f = new Form2();
            f.Show();
        }
    }
}
Form2:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();

        }

        private void progressBar1_Click(object sender, EventArgs e)
        {

        }

        private void Form2_Load(object sender, EventArgs e)
        {
            button1.Text = "关闭";
            button2.Text = "启动上方按钮";
            button3.Text = "禁用上方按钮";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            button1.Enabled = true;
            this.Refresh();
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            Close();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
            this.Refresh();
        }
    }
}
批注 2020-07-28 132200.jpg




上一篇:Windows api如何调整窗口大小
下一篇:无法打开内存
您需要登录后才可以回帖 登录 | 加入驿站 qq_login

本版积分规则

×【发帖 友情提示】
1、请回复有意义的内容,请勿恶意灌水;
2、纯数字、字母、表情等无意义的内容系统将自动删除;
3、若正常回复后帖子被自动删除,为系统误删的情况,请重新回复其他正常内容或等待管理员审核通过后会自动发布;
4、感谢您对VC驿站一如既往的支持,谢谢合作!

关闭

站长提醒上一条 /2 下一条

QQ|小黑屋|手机版|VC驿站 ( 辽ICP备09019393号-4 )|网站地图wx_jqr

GMT+8, 2023-9-29 12:34

Powered by CcTry.CoM

© 2009-2021 cctry.com

快速回复 返回顶部 返回列表