##現在のプログラム
c#
1 2public void CreateMyPanel() 3 { 4 System.Windows.Forms.Panel panel1 = new System.Windows.Forms.Panel(); 5 System.Windows.Forms.TextBox textBox1 = new System.Windows.Forms.TextBox(); 6 System.Windows.Forms.Label label1 = new System.Windows.Forms.Label(); 7 8 // Initialize the Panel control. 9 panel1.Location = new System.Drawing.Point(56, 72); 10 panel1.Size = new System.Drawing.Size(264, 152); 11 // Set the Borderstyle for the Panel to three-dimensional. 12 panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; 13 14 // Initialize the Label and TextBox controls. 15 label1.Location = new System.Drawing.Point(16, 16); 16 label1.Text = "label1"; 17 label1.Size = new System.Drawing.Size(104, 16); 18 textBox1.Location = new System.Drawing.Point(16, 32); 19 textBox1.Text = ""; 20 textBox1.Size = new System.Drawing.Size(152, 20); 21 22 panel1.BackgroundImageLayout = ImageLayout.Zoom; 23 panel1.BackgroundImage = System.Drawing.Image.FromFile(@"C:\S__82993161.jpg"); 24 25 this.Controls.Add(panel1); 26 // Add the Label and TextBox controls to the Panel. 27 panel1.Controls.Add(label1); 28 panel1.Controls.Add(textBox1); 29 }
##起きているエラー
this.Controls.Add(panel1);
のAddの部分で
エラー CS1061 'object' に 'Add' の定義が含まれておらず、型 'object' の最初の引数を受け付けるアクセス可能な拡張メソッド 'Add' が見つかりませんでした。using ディレクティブまたはアセンブリ参照が不足していないことを確認してください。
というエラーが出てしまいます
どなたか解決方法を教えていただけないでしょうか?
あなたの回答
tips
プレビュー