开发者

Is it possible to create a JPG from a Control?

Lets sa开发者_如何学Cy I have a custom control (child of System.Windows.Forms.UserControl) such as a graph. Is there a way I can take the drawing I did on the control and just export the current graphical state of the control to a JPG file?


It is possible. Basically you will need to ask the control to render itself to a Bitmap and then save the Bitmap as jpeg

See the documentation of Control.DrawToBitmap() method.

Bitmap bmp = [Control.DrawToBitmap();
            bmp.Save("", System.Drawing.Imaging.ImageFormat.Jpeg);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜