private void btCut_Click(object sender, EventArgs e)
{
if (!File.Exists(tbImagePath.Text)) { MessageBox.Show("请先把要切割的图片拖拽到程序上", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
if (!Directory.Exists(SavePath))
Directory.CreateDirectory(SavePath);
FileInfo fileImg = new FileInfo(tbImagePath.Text);
using (Bitmap b = new Bitmap(fileImg.FullName))
{
List<Rectangle> lstRect = CreateAvgCutRectangle(b.Width, b.Height, (int)numCutRows.Value, (int)numCutCells.Value);
for (int i = 0; i < lstRect.Count; i++)
{
CutImage(tbImagePath.Text, lstRect[i].X, lstRect[i].Y, lstRect[i].Width, lstRect[i].Height,
string.Format("{0}_{1}.bmp", fileImg.Name.Remove(fileImg.Name.LastIndexOf(".")),
NumToNostring(i)));
}
}
System.Diagnostics.Process.Start("explorer.exe", SavePath);
}