In meiner C# Windows-Anwendung i erfolgreich panel1 als Bild (bmp, jpg, png) erfaßt unter CodeCapture-div als Bild asp.net mit - C#
int x1 = SystemInformation.WorkingArea.X;
int y1 = SystemInformation.WorkingArea.Y;
int width1 = panel1.Width;
int height1 = panel1.Height;
Rectangle bounds1 = new Rectangle(x1, y1, width1, height1);
Bitmap img1 = new Bitmap(width1, height1);
panel1.DrawToBitmap(img1, bounds1);
ich diesen Code verwenden in meiner asp Website Capture asp Panel als Bild. Aber SystemInformation
und DrawToBitmap
funktioniert nicht im Web-Projekt. Kann jemand mir eine Idee geben, wie man Asp-Panel mit tatsächlicher Breite und Höhe erfasst.
mein voller Windows-app Button-Code wird unter
gegebenprivate void savetypebtn_Click(object sender, EventArgs e)
{
try
{
int x1 = SystemInformation.WorkingArea.X;
int y1 = SystemInformation.WorkingArea.Y;
int width1 = panel1.Width;
int height1 = panel1.Height;
Rectangle bounds1 = new Rectangle(x1, y1, width1, height1);
Bitmap img1 = new Bitmap(width1, height1);
panel1.DrawToBitmap(img1, bounds1);
string saved_file = "";
savedialog.InitialDirectory = "D:";
savedialog.Title = "Save Quotation";
savedialog.FileName = "";
savedialog.Filter = "Jpg image|*.jpg|Bitmap image|*.bmp|png image|*.png";
if (savedialog.ShowDialog() != DialogResult.Cancel)
{
saved_file = savedialog.FileName;
img1.Save(saved_file, System.Drawing.Imaging.ImageFormat.Bmp);
}
}
catch (Exception ex)
{
errorlbl.Visible=True;
errorlbl.Text = ex.Message;
}
DrawToBitmap wird nicht unterstützt nach. NET 4.0 –