How to get a screen capture of a .Net WinForms control programmatically?

前端 未结 7 2042
抹茶落季
抹茶落季 2020-12-13 09:30

How do you programmatically obtain a picture of a .Net control?

7条回答
  •  攒了一身酷
    2020-12-13 09:53

    For WinForms controls that support it, there is a method in the System.Windows.Forms.Control class:

    public void DrawToBitmap(Bitmap bitmap, Rectangle targetBounds);
    

    This does not work with all controls, however. Third party component vendors have more comprehensive solutions.

提交回复
热议问题