且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将表单图像保存为文件

更新时间:2023-02-15 11:32:35

好吧,我认为这样可以做到:

Well, I think this will do :

<br />
Bitmap MyBitmap = new Bitmap(this.Width, this.Height); <br />
this.DrawToBitmap(MyBitmap, new Rectangle(0,0,this.Width,this.Height)); MyBitmap.Save(@"c:\Test.bmp", ImageFormat.Bmp); <br />



并且您可以通过更改最后一行中的ImageFormat来使用任何格式来保存它.

-----------------
问候

H.Maadani



and you can use any format to save it by changing ImageFormat in the last line.

-----------------
Regards

H.Maadani


然后您将其放在Command_click()语句中?
And you would put that in a Command_click() statement??


当然!

我注意到您想要VB.NET中的解决方案,我上面编写的代码在C#中.您需要将一些代码更改为VB(请将此更改为Me).我对VB不那么熟悉,所以我不能自己写.但这并不复杂.

-------------
问候

H.Maadani
Of course!

I noticed that you wanted solution in VB.NET , the code I''ve written above is in C#. you''ll need to change some codes to VB (lik this to Me). I''m not that familliar with VB so I cant write it myself. but it is not that complicated.

-------------
Regards

H.Maadani