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.
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.
Please login first to submit.