C# ASP.net创建一个映像

C# ASP.net创建一个映像,c#,asp.net,image-processing,gdi+,C#,Asp.net,Image Processing,Gdi+,迷失在这一点上,我开发了一个拖放区域 我有: 一组x、y宽度和高度都已知的图像 一组文本标签,所有标签都带有x、y、fontsize、文本等,所有标签都是已知的 如何将其转换为图像文件,以便对其进行缩略?不知道从哪里开始。创建所需大小的位图,从中获取图形实例,然后开始绘图 Bitmap bmp = new Bitmap(height,width); using gfx = Graphics.FromImage(bmp) { // then draw on the gfx instance,

迷失在这一点上,我开发了一个拖放区域

我有:

一组x、y宽度和高度都已知的图像 一组文本标签,所有标签都带有x、y、fontsize、文本等,所有标签都是已知的


如何将其转换为图像文件,以便对其进行缩略?不知道从哪里开始。

创建所需大小的位图,从中获取图形实例,然后开始绘图

Bitmap bmp = new Bitmap(height,width);
using gfx = Graphics.FromImage(bmp) {
  // then draw on the gfx instance, flush, and then save the bitmap.
  gfx.DrawString(...)//with your position information
  gfx.DrawImage(...)//with your position,font,text info
  gfx.Flush();
}
bmp.Save(...);

下面的问题包含动态生成缩略图的代码,请参见我的答案: