一、窗体及功能实现
二、代码
【1】加载窗体
public 图片()
{
InitializeComponent();
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.pMouseWheel);
}
【2】变量
private List<string> ImagePaths = new List<string>();
string PicPath;
string APath;
string[] AllPath;
int PicNum = 0;
private string PicNumber;
private string PicNow;
【3】打开图片
private void button1_Click(object sender, EventArgs e)
{
ImagePaths.Clear();
OpenFileDialog OpenPic = new OpenFileDialog();
OpenPic.Title = "请选择要打开的文件";
OpenPic.InitialDirectory = @"C:\";
OpenPic.Filter = "所有图片(*.jpg*.jpeg*.bmp*.gif*.png)|*.jpg;*.jpeg;*.bmp;*.gif;*.png|JPG图片(*.jpg)|*.jpg;*.jpeg|位图(*bmp)|*.bmp|GIF文件(*.gif)|*.gif|PNG文件(*.png)|*.png";
OpenPic.ShowDialog();
PicPath = OpenPic.FileName;
if (PicPath == "")
{
return;
}
else
{
APath = Path.GetDirectoryName(PicPath);
AllPath = Directory.GetFiles(APath);
string BPath = PicPath