teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

回答に追記

2018/06/01 06:25

投稿

y_waiwai
y_waiwai

スコア88180

answer CHANGED
@@ -2,4 +2,30 @@
2
2
 
3
3
  comboBox.Parent = this; //MainFormの上で出すなら
4
4
 
5
- その他、Locationとかも設定してやらないと。
5
+ その他、Locationとかも設定してやらないと。
6
+
7
+ ---
8
+ ソースが修正されてワケワカメに。
9
+ んじゃ最初から。
10
+
11
+ ・新規にプロジェクト作成、VisualC#>Windowsフォームアプリケーションを選択
12
+ ・ソースに以下を追加
13
+ ```C#
14
+ public partial class Form1 : Form
15
+ {
16
+ public Form1()
17
+ {
18
+ InitializeComponent();
19
+
20
+ ComboBox cb = new ComboBox();
21
+ cb.Items.Add("aaaa");
22
+ cb.Items.Add("bbbb");
23
+ cb.Items.Add("cccc");
24
+ cb.Parent = this;
25
+ }
26
+ }
27
+ ```
28
+ ・で実行すると、
29
+ ![イメージ説明](9b4cded5ad6ca94f99bb05ef8b14d8dd.png)
30
+
31
+ ・バッチシ!