写一个Class,继承ComBoBox,设置属性checkusing System; using System.Collections.Generic; using System.Text; using System.Windows.Forms;namespace MutliForms { class ComboV1:ComboBox { private bool check; public bool Check { get { return check; } set { check = value; } } } } 在要用的form中添加ComboV1就可以了
接上: 例如,在Form1.cs中using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;namespace MutliForms { public partial class Form1 : Form { public Form1() { InitializeComponent(); ComboV1 cb = new ComboV1(); cb.Width = 100; cb.Height = 20; cb.Left = 10; cb.Top = 20; cb.Name = "testcombo"; cb.Items.Add("aaa");
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;namespace MutliForms
{
class ComboV1:ComboBox
{
private bool check;
public bool Check
{
get
{
return check;
}
set
{
check = value;
}
}
}
}
在要用的form中添加ComboV1就可以了
例如,在Form1.cs中using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace MutliForms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
ComboV1 cb = new ComboV1();
cb.Width = 100;
cb.Height = 20;
cb.Left = 10;
cb.Top = 20;
cb.Name = "testcombo";
cb.Items.Add("aaa");
groupBox1.Controls.Add(cb);
}
}
}