Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Compare()
- {
- int flag = 0;
- int count1 = 0;
- int count2 = 0;
- string img1_ref, img2_ref;
- Bitmap img1 = new Bitmap(@"c:\Fotky\Obrazok1.bmp");
- Bitmap img2 = new Bitmap(@"c:\Fotky\Obrazok1por.bmp"); // originál
- if (img1.Width == img2.Width && img1.Height == img2.Height)
- {
- for (int i = 0; i < img1.Width; i++)
- {
- for (int j = 0; j < img1.Height; j++)
- {
- img1_ref = img1.GetPixel(i, j).ToString();
- img2_ref = img2.GetPixel(i, j).ToString();
- if (img1_ref != img2_ref)
- {
- count2++;
- flag = 1;
- break;
- }
- count1++;
- }
- }
- if (flag == 1)
- {
- Bitmap printscreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
- Graphics graphics = Graphics.FromImage(printscreen as Image);
- graphics.CopyFromScreen(17, 231, 1885, 1054, printscreen.Size);
- printscreen.Save(@"C:\Fotky\Obrazok1.bmp");
- System.Threading.Thread.Sleep(650);
- Compare();
- }
- else
- {
- click6();
- }
- }
- this.Dispose();
- }
Advertisement
Add Comment
Please, Sign In to add comment