ユーザーがテキストボックスに入力した内容に応じて、実行時に画像をロードしたいピクチャボックスがあります。
プロジェクト内に Formations.resx という名前のファイルを作成し、そこにイメージをロードしました。次の両方を試しましたが、うまくいきませんでした。何が間違っていますか?
pictureBoxFormation.Image = Properties.Resources.ResourceManager.GetObject("random_" + firstPoint) as Image;
このコードは正常に実行.Imageされますが、私のピクチャ ボックスのプロパティは更新されません。
ResourceManager rm = new ResourceManager("Formations", Assembly.GetExecutingAssembly());
pictureBoxFormation.Image = rm.GetObject("random_" + firstPoint) as Image;
これにより、次のようなエラーがスローされます。
An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Formations.resources" was correctly embedded or linked into assembly "WindowsFormsApplication1" at compile time, or that all the satellite assemblies required are loadable and fully signed.