私の悪い英語でごめんなさい。私はこことC#も初めてです。PictureBox に画像が含まれ、TextBox にテキストが含まれる Form の領域をスクリーン キャプチャする方法を教えてください。保存されたスクリーンショットの画像に、PictureBox の画像と TextBox のテキストが含まれていないことを除けば、すべて問題ありません。私は何を間違っていますか?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class ID_Editor_Form : Form
{
Image File;
int TogMove; int MValX; int MValY;
public ID_Editor_Form()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
TogMove = 1; MValX = e.X; MValY = e.Y;
}
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
TogMove = 0;
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (TogMove == 1)
{
this.SetDesktopLocation(MousePosition.X - MValX, MousePosition.Y - MValY);
}
}
OpenFileDialog BrowseID = new OpenFileDialog();
private void button3_Click(object sender, EventArgs e)
{
BrowseID.Filter = "JPG|*.jpg|JPEG|*.jpeg|PNG|*.png|All Files|*.*";
if (BrowseID.ShowDialog() == DialogResult.OK)
{
File = Image.FromFile(BrowseID.FileName);
pictureBox2.Image = File;
}
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap bitmap = new Bitmap(this.Width, this.Height - 48);
DrawToBitmap(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
bitmap.Save("C:\\Users\\ROBO\\Desktop\\Screen.png", ImageFormat.Png);
MessageBox.Show("Saved Completed");
}
}
}