Dictionary<int, PictureBox> aCollection;
aCollection = new Dictionary<int, PictureBox>();
aCollection.Add(333, new PictureBox
{
Name = "Alcoholism",
Image = Resources.alcoholism,
Size = new Size(22, 22),
SizeMode = PictureBoxSizeMode.StretchImage
});
aCollection.Add(289, new PictureBox
{
Name = "Hypertension",
Image = Resources.hypertension,
Size = new Size(22, 22),
SizeMode = PictureBoxSizeMode.StretchImage
});
PictureBox condition = aCollection[333]; //333 refers to alcoholism
condition.Location = new Point(450, 155);
displayForm.Controls.Add(condition);
PictureBox another = aCollection[289]; //289 refers to hypertension
another.Location = new Point(550, 155);
displayForm.Controls.Add(another);
コードはWinフォーム(アイコンに注意してください)に次のような出力をレンダリング同じピクチャボックスを表示できません私は1つのアイコンのOUTP取得は、上記の複数回
PictureBox condition = aCollection[289]; //Hypertension
condition.Location = new Point(450, 155);
displayForm.Controls.Add(condition);
PictureBox another = aCollection[289]; //Hypertension
another.Location = new Point(550, 155);
displayForm.Controls.Add(another);
すなわち二回同じアイコンを表示することを望んで同じアイコン、 ut。
私が間違っているところ誰かが助言していただけますか?ありがとうございました。
[編集] - 以下のコードはまた、唯一1つのアイコン
PictureBox condition = aCollection[289];
condition.Location = new Point(450, 155);
displayForm.Controls.Add(condition);
PictureBox another = condition;
another.Location = new Point(550, 155);
displayForm.Controls.Add(another);
方法別=条件のPictureBox 'については、'とそのまま残りは次のようになります。その後、
と使用画像ボックスを追加します。このクラスを追加します。 –