DrawToBitmap

0
0

Hi!

I need to add controls into a panel and save it to bitmap. Is DrawToBitmap obsolete?

How can I to do it with Canvas? May you help me, please?

Code:

Imports System.Drawing

Public Class Page1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim bmp As Bitmap = New Bitmap(Panel1.ClientSize.Width, Panel1.ClientSize.Height)
Dim Botao As New Wisej.Web.Button

Botao.Left = 0
Botao.Top = 0
Botao.BackColor = Color.Red
Botao.Text = “Teste”
Botao.Visible = True
Panel1.Controls.Add(Botao)

Panel1.DrawToBitmap(bmp, Panel1.ClientRectangle)
bmp.Save(“C:\Temp\Temp.jpg”, Imaging.ImageFormat.Jpeg)
End Sub
End Class

Thanks,
Ulisses.

  • You must to post comments
0
0

Wisej controls are HTML widgets. There is no drawing to bitmap supported by any browser.

You can try the Html2Canvas extension. It lets you “capture” an image rendering of a specific control or of the entire page. It also works with async code.

  • Ulisses
    Thanks, Luca!
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.