!急:我在窗口上画了一些图案,我应该怎么保存? 在Form的OnPaint事件中,重画你的那些图案就可以了.OnPaint事件是当你的窗体要重绘的时候发生. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以调用BitBlt API将整个Form画到一个Image上,1. Import the BitBlt API function2. Capture the image of the form代码片断如下:[DllImport("gdi32.dll")]private static extern bool BitBlt(IntPtr hdcDest, // handle to destination DCint nXDest, // x-coord of destination upper-left cornerint nYDest, // y-coord of destination upper-left cornerint nWidth, // width of destination rectangleint nHeight, // height of destination rectangleIntPtr hdcSrc, // handle to source DCint nXSrc, // x-coordinate of source upper-left cornerint nYSrc, // y-coordinate of source upper-left cornerSystem.Int32 dwRop // raster operation code);private const Int32 SRCCOPY = 0xCC0020;private Bitmap memImage;private void PrepareImage(){Graphics graphic = this.CreateGraphics();Size s = this.Size;memImage = new Bitmap(s.Width, s.Height, graphic);Graphics memGraphic = Graphics.FromImage(memImage);IntPtr dc1 = graphic.GetHdc();IntPtr dc2 = memGraphic.GetHdc();BitBlt(dc2, 0, 0, this.ClientRectangle.Width,this.ClientRectangle.Height,dc1, 0, 0, SRCCOPY);graphic.ReleaseHdc(dc1);memGraphic.ReleaseHdc(dc2);} 下面这个地方也有一个完整的代码http://www.aspxcn.com/dotnetbbs/View.aspx?fbId=23&Id=85167 C#读取指定的.dbf文件 winform的图形按钮求例程 菜鸟问题,c#有两个窗口form1,form2,怎么让程序启动先出现form2 Access数据连接问题 大家来讨论一下如何反馈应用程序操作步骤信息! 尊敬的高手们:winform中怎样用代码使光标落在datagrid中任意的行和列。在线~~~~~~ 如何将一个类作为参数传递给一个函数? text,richtext控件禁用后灰色,能改颜色吗? C#中怎么实现代码打印rdlc报表(webform) DataGrid控件问题? C#开发过程中如何设置程序的启动位置? c#如何获取C盘的序列号?
2. Capture the image of the form代码片断如下:[DllImport("gdi32.dll")]
private static extern bool BitBlt(
IntPtr hdcDest, // handle to destination DC
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
IntPtr hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
System.Int32 dwRop // raster operation code
);private const Int32 SRCCOPY = 0xCC0020;private Bitmap memImage;private void PrepareImage()
{
Graphics graphic = this.CreateGraphics();
Size s = this.Size;
memImage = new Bitmap(s.Width, s.Height, graphic);
Graphics memGraphic = Graphics.FromImage(memImage);
IntPtr dc1 = graphic.GetHdc();
IntPtr dc2 = memGraphic.GetHdc();
BitBlt(dc2, 0, 0, this.ClientRectangle.Width,
this.ClientRectangle.Height,dc1, 0, 0, SRCCOPY);
graphic.ReleaseHdc(dc1);
memGraphic.ReleaseHdc(dc2);
}
下面这个地方也有一个完整的代码
http://www.aspxcn.com/dotnetbbs/View.aspx?fbId=23&Id=85167