打印舞蹈学校ID的屏幕区域?

时间:2016-04-13 01:37:54

标签: c# screen-capture image-capture printscreen

抱歉我的英语不好。我是新来的,也是C#的。 我需要屏幕捕获窗体区域的帮助,该区域包含PictureBox中的图像和TextBox中的文本。一切都很好,除了保存的截图图像不包含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");

         }

     }

}

0 个答案:

没有答案