Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi, I need to create an application in C# that captures part of the screen when certain part of the same screen changes. Thank you all.
Posted


the idea from your problem takes multiple screen capture every constant time period and compare the images which taken pixel by pixel to select the part of screen was changed and captured it


Bitmap image1;
Bitmap image2;
Graphics gr;
private void Captures_Images()
{
    Bitmap image1 = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    Graphics gr = Graphics.FromImage(image1);
    gr.CopyFromScreen(0, 0, 0, 0, image1.Size);
    gr = null;
    pictureBox1.Image = image1;


    // Here Break Time Between Captured

    Bitmap image2 = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    gr = Graphics.FromImage(image2);
    gr.CopyFromScreen(0, 0, 0, 0, image2.Size);
    gr = null;
    pictureBox1.Image = image2;
}
void Compare_Images(Bitmap b1,Bitmap b2)
{
    int width = b1.Width;
    int height = b1.Height;
    for (int w = 0; w < width; w++)
    {
        for (int h = 0; h < height; h++)
        {
            if ((b1.GetPixel(w, h).A != b2.GetPixel(w, h).A) ||
                (b1.GetPixel(w, h).R != b2.GetPixel(w, h).R) ||
                (b1.GetPixel(w, h).G != b2.GetPixel(w, h).G) ||
                (b1.GetPixel(w, h).B != b2.GetPixel(w, h).B))
            {
                // Changed Bounds Start
            }
        }
    }
}
 
Share this answer
 
v3
Comments
Sandeep Mewara 10-Sep-10 8:06am    
Update on answer: the idea from your problem takes multiple screen capture every constant time period and compare the images which taken pixel by pixel to select the part of screen was changed and captured it
Maybe something here[^] can help.
 
Share this answer
 
Did you see my article on screen capture.

http://www.codeproject.com/Articles/91487/Screen-Capture-in-WPF-WinForms-Application.aspx[^]

I have also provided you a sample application with my article.
 
Share this answer
 
It really depends on what form would you want the screen capture to be.
If you just wanted a Bitmap object, this should do:
Bitmap screen_image = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); 


Just tweak out the width and height
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900