http://www.gotdotnet.com/japan/student/column/moredotnet/moredotnet2.aspx
このプログラムを作ってみたのですが、このコードではbmp以外は読み込まない設定
になっているようですが、これをbmp,jpgなど複数の拡張子のものを読み込むようにするには
どういったコードを書けば良いでしょうか?
VisualC#で
問題のコードは
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
// 選択されたファイルが .bmp という拡張子のときだけフィールドに追加する
foreach(string f in openFileDialog1.FileNames)
{
if(System.IO.Path.GetExtension(f)==".bmp")
this.fileNames.Add(f);
}
// 追加された画像ファイルの最後の画像を表示する
int fcnt = fileNames.Count;
if(fcnt != 0)
this.showImage((string)this.fileNames[fcnt-1]);
}
}