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

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

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

相关标签:
7条回答
  • 2020-12-13 10:11

    There's a method on every control called DrawToBitmap. You don't need to p/invoke to do this.

    Control c = new TextBox();
    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(c.Width, c.Height);
    c.DrawToBitmap(bmp, c.ClientRectangle);
    
    0 讨论(0)
提交回复
热议问题