public bool StartMergeFile(ImagesInfo pImagesInfo)
{
bool Ok = false;
try
{
this.m_ImagesInfo = pImagesInfo;
string ImagePath = this.m_ImagesInfo.RootPath + @"/" + this.m_ImagesInfo.Level.ToString();
System.Drawing.Image pImgCon = new System.Drawing.Bitmap(256 * this.m_ImagesInfo.ImgRow, 256 * this.m_ImagesInfo.ImgColumn);
System.Drawing.Graphics pGraphics = System.Drawing.Graphics.FromImage(pImgCon);
pGraphics.Clear(Color.Transparent);
string[] dirs = Directory.GetFiles(ImagePath, "*.png");
if (dirs.Length <= 0)
dirs = Directory.GetFiles(ImagePath, "*.jpg");
if (dirs.Length <= 0)
dirs = Directory.GetFiles(ImagePath, "*.gif");
foreach (string dir in dirs)
{
string theName = System.IO.Path.GetFileNameWithoutExtension(dir);
string[] NameList = theName.Split('_');
int Col = int.Parse(NameList[1]);
int Row = int.Parse(NameList[2]);
Point pLocation = new Point(Row * 256, Col * 256);
Image CurImage = Image.FromFile(dir);
pGraphics.DrawImage(CurImage, pLocation);
CurImage.Dispose();
}
string Savepath = ImagePath + ".jpg";
pImgCon.Save(Savepath);
pGraphics.Dispose();
pImgCon.Dispose();
Ok = true;
}
catch (Exception exp)
{
throw exp;
}
return Ok;
}