0
イメージをコピーしてGUIDで名前を変更しても問題は発生しませんでした。 しかし、私はピクチャボックスに、たとえば、このイメージを開いてみたかったとき、私はこれだ:私はこのファイルを開くことができますどのように@"images\full_45e72053-440f-4f20-863c-3d80ef96876f.jpeg"
パスに不正な文字を含むファイルを開く
生成された名前は次のようになりますか?
これは私にこの問題を示して私のコードです:
private void picBoxMini2_Click(object sender, EventArgs e)
{
string dir = ConfigurationManager.AppSettings["imageFolderPath"].ToString();
string imgName = this.picBoxMini2.ImageLocation;
string[] tmp = imgName.Split('_');
this.picBoxMain.Image = Image.FromFile($"{dir}\full_{tmp[tmp.Length - 1]}");
}
ImageLocationは、私がこのような状況に被保険者、100%の情報が含まれています
string dir = ConfigurationManager.AppSettings["imageFolderPath"].ToString();
if (imgs.Length >= 1)
{
this.picBoxMain.Image = Image.FromFile([email protected]"{dir}\full_{imgs[0]}");
this.picBoxMain.ImageLocation = [email protected]"{dir}\full_{imgs[0]}";
this.picBoxMini1.Image = Image.FromFile([email protected]"{dir}\85_{imgs[0]}");
this.picBoxMini1.ImageLocation = [email protected]"{dir}\85_{imgs[0]}";
this.picBoxMini2.Image = null;
this.picBoxMini2.ImageLocation = null;
this.picBoxMini3.Image = null;
this.picBoxMini3.ImageLocation = null;
}
if (imgs.Length >= 2)
{
this.picBoxMini2.Image = Image.FromFile([email protected]"{dir}\85_{imgs[1]}");
this.picBoxMini2.ImageLocation = [email protected]"{dir}\85_{imgs[1]}";
}
if (imgs.Length == 3)
{
this.picBoxMini3.Image = Image.FromFile([email protected]"{dir}\85_{imgs[2]}");
this.picBoxMini3.ImageLocation = [email protected]"{dir}\85_{imgs[2]}";
}
最初のコードブロックの '.FromFile'呼び出しで' @ 'を忘れたと思います。 –
@BradleyUffnerはいそれはあります!私はとても疲れていて、このシンボルを見逃していました。今、すべて完璧に動作します! THX – NemoUA