不明白这个
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ch1_3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int widthmin = System.Decimal.ToInt32(numericUpDown1.Value);
int heightmin = System.Decimal.ToInt32(numericUpDown3.Value);
int widthmax = System.Decimal.ToInt32(numericUpDown2.Value);
int heightmax = System.Decimal.ToInt32(numericUpDown4.Value);
DialogResult dr, dr2;
if (widthmin > widthmax)
{
dr = MessageBox.Show("设置的最小宽度比最大宽度还大,如果坚持此设置,窗体的宽度将固定为最大宽度",
"警告",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
if (dr == DialogResult.OK)
{
}
else if (dr == DialogResult.Cancel)
{
numericUpDown1.Value = 300;
numericUpDown2.Value = 300;
numericUpDown3.Value = 300;
numericUpDown4.Value = 300;
}
}
if (heightmin > heightmax)
{
dr2 = MessageBox.Show("设置的最小高度比最大高度还大,如果坚持此设置,窗体的宽度将固定为最大高度"
,"警告",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
if (dr2 == DialogResult.OK)
{
}
else if (dr2 == DialogResult.Cancel)
{
numericUpDown3.Value = 300;
numericUpDown4.Value = 300;
}
}
widthmin = System.Decimal.ToInt32(numericUpDown1.Value);
heightmin = System.Decimal.ToInt32(numericUpDown3.Value);
widthmax = System.Decimal.ToInt32(numericUpDown2.Value);
heightmax = System.Decimal.ToInt32(numericUpDown4.Value);
Size p1 = new Size(widthmin, heightmin);
Size p2 = new Size(widthmax, heightmax);
this.MinimumSize = p1;
this.MaximumSize = p2;
}
}
}
错误 1 “ch1_3.Form1”不包含“groupBox1_Enter”的定义,并且找不到可接受类型为“ch1_3.Form1”的第一个参数的扩展方法“groupBox1_Enter”(是否缺少 using 指令或程序集引用?) I:\娱乐\ch1-3\ch1-3\Form1.Designer.cs 65 66 ch1-3