Winfrom弹出对话框后不让父窗体操作,并且背景变色

来源:百度知道 编辑:UC知道 时间:2024/06/21 07:02:53
是WINFROM 程序 不是WEB
类似windows系统点注销后的效果

|---- set Gogal 这什么意思? ----|

set Gogal

很好实现的 弹出对话框的时候 用ShowDialog的方法 而不是Show()方法

比如下面这个程序 让AboutBox弹出来后 Form1改变
下面是Form1窗体的代码 Form里面就一个button

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

namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
AboutBox1 aboutbox = new AboutBox1();
this.BackColor = Color.Yellow;
aboutbox.ShowDialog();
}
}
}