问题描述
Dictionary<string,Hero>monsters=newDictionary<string,Hero>();OpenFileDialogof=newOpenFileDialog();of.Multiselect=true;of.Filter="jpg文件;asdfsad;asdfsa|*.jpg|bmp文件|*.bmp|gif文件|*.gif";if(of.ShowDialog(this)==DialogResult.OK){monsters.Clear();for(inti=0;i<of.FileNames.Length;i++){stringss=of.FileNames[i];FileStreamfs=newFileStream(ss,FileMode.Open,FileAccess.Read);System.Drawing.ImageobjPic=newSystem.Drawing.Bitmap(fs);fs.Close();intw=objPic.Height;inty=objPic.Width;if(monsters.ContainsKey(ss)){monsters[ss]=newHero(Image.FromFile(ss),newSize(w,y),newPoint(w,y));}else{monsters.Add(ss,newHero(Image.FromFile(ss),newSize(w,y),newPoint(w,y)));}}}
时间: 2024-08-04 02:18:21