11 Aralık 2015 Cuma

C# Ekran Görüntüsünü PictureBox' a Aktarmak



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;

namespace Ekran_Video_Çekimi
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        Bitmap bmp;
        Graphics gr;
        private void timer1_Tick(object sender, EventArgs e)
        {
            bmp = new Bitmap(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
            gr = Graphics.FromImage(bmp);
            gr.CopyFromScreen(0, 0, 0, 0, new Size(bmp.Width, bmp.Height));
            pictureBox1.Image = bmp;
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            timer1.Stop();
        }
        Random rnd = new Random();
        private void button3_Click(object sender, EventArgs e)
        {
            pictureBox1.Image.Save("C:/ekran" + rnd.Next(0,1000) + ".jpg");
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://csharp-uygulamalari.blogspot.com.tr/");
            MessageBox.Show("Hazırlayan: Fikri KOCAOĞLAN","Bilgi",MessageBoxButtons.OK,MessageBoxIcon.Information);
        }
    }
}

Programın Çalışması:

Paylaş:

0 yorum:

Yorum Gönder

Popüler

Son

Kategoriler