いつもお世話になります。
C#でFormを継承した場合、もとのForm1にあったオブジェクトとForm2で実装したオブジェクトをわけて扱いたいです。
どのような条件を設定すればよいか、ご示唆ください。
環境は、Visual Studio 2013 Express edition Windows 8.1です。
namespace test{
public partial class Form2 : Form1 {
public Form2() {
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e) { Button button2 = new Button(); this.Controls.Add(button2); //ここでForm1から継承したボタンのみを分けて扱いたい。 foreach (Control control in this.Controls) { if (継承の場合) { } else{ } }
}
}
namespace test{
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
Button button1 = new Button();
this.Controls.Add(button1);
}
}
}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。