تصوير الشاشة بلغة #C

تصوير الشاشة بلغة السي شارب


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Drawing.Imaging;



namespace screenCapture

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }



        void Snapshot()

        {

            Bitmap screen = new Bitmap(Screen.PrimaryScreen.Bounds.Width,

                Screen.PrimaryScreen.Bounds.Height);

            Graphics g = Graphics.FromImage(screen);

            g.CopyFromScreen(0,0, 0, 0, screen.Size);            

            pictureBox1.Image = screen;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)

                screen.Save(saveFileDialog1.FileName, ImageFormat.Bmp);

        }

        private void button1_Click(object sender, EventArgs e)

        {

            this.Snapshot();

        }



        private void btnCapturetime_Click(object sender, EventArgs e)

        {

            timer1.Interval = Convert.ToInt32(comboBox1.Text)*1000;

            timer1.Enabled = true;

        }        

        private void timer1_Tick(object sender, EventArgs e)

        {

            timer1.Enabled = false;

            this.Snapshot();



        }

    }

}

تحميل المشروع   https://cut-win.com/dIx6


ليست هناك تعليقات:

يتم التشغيل بواسطة Blogger.