2014-01-08 23 views

回答

0

不,在ASP.NET Panel控件中没有DrawToBitmap方法。不用说,你不能在你的ASP.NET项目中引用Windows窗体程序集来实现这一点。

你得到的最好的照片是将所有这些图像合并成一个。下面是一个示例C#代码...

public static System.Drawing.Bitmap Combine(string[] files) 
{ 
    //read all images into memory 
    List<System.Drawing.Bitmap> images = new List<System.Drawing.Bitmap>(); 
    System.Drawing.Bitmap finalImage = null; 

    try 
    { 
    int width = 0; 
    int height = 0; 

    foreach (string image in files) 
    { 
     //create a Bitmap from the file and add it to the list 
     System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(image); 

     //update the size of the final bitmap 
     width += bitmap.Width; 
     height = bitmap.Height > height ? bitmap.Height : height; 

     images.Add(bitmap); 
    } 

    //create a bitmap to hold the combined image 
    finalImage = new System.Drawing.Bitmap(width, height); 

    return finalImage; 
    } 
    catch(Exception ex) 
    { 
    if (finalImage != null) 
     finalImage.Dispose(); 

    throw ex; 
    } 
    finally 
    { 
    //clean up memory 
    foreach (System.Drawing.Bitmap image in images) 
    { 
     image.Dispose(); 
    } 
    } 
} 
+0

但如果我有不同的possitions因为我创建一个拖放图像。 – MMakati

+0

您可以随时收集图像名称和位置,然后将其发送到服务器进行处理 – Leo

相关问题