cが私は正常私は私のASPのウェブサイトにこのコードを使用するコードキャプチャのdiv - 私のC#のWindowsアプリケーションで#
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);
の下に使用した画像(BMP、JPG、PNG)としてパネル1を捕獲します画像としてaspパネルをキャプチャします。しかし、SystemInformation
とDrawToBitmap
はWebプロジェクトでは機能しません。誰も私にどのように実際の幅と高さでASPパネルをキャプチャするアイデアを与えることができます。
私の完全なWindowsアプリのボタンのコードは、これは私が見つけた解決策である
private 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は.net 4.0の後ではサポートされていません。 –