Results 1 to 3 of 3

Thread: moving bitmap

  1. #1
    Senior Member
    rikkimartin is offline

    Posts
    184

    moving bitmap

    Currently coding some things in the works however, i need to find an image on the screen that moves... for example in the view windows of the ocean when sailing. i need the program to watch that window and perform a function when say a ship enters the window eg :click turn about .. thats all well n good but at the moment im using a screenshot of the screen and finding the bitmap of a ship in that... I have it on a timer ever second but it makes the program run very slow because its trying to take a screen every second when a ship does enter the screen its to slow to respond.

    What other method could i use to speed up the process?

    cheers
    Skype: blazikin6

  2. #2
    #Return
    Scarecrow is offline

    Posts
    3,443
    Investigate faster ways to take screenshots and then find an image.

    How long does it currently take you to take a screenshot and search it??
    Also, how big is the screenshot?

  3. #3
    Senior Member
    rikkimartin is offline

    Posts
    184
    I have this code now to get just a windows


    if (!GetWindowRect(window, out myRect))


    {
    MessageBox.Show("ERROR");
    return;
    }


    myRect.X = myRect.Left;
    myRect.Y = myRect.Top;
    myRect.Width = myRect.Right - myRect.Left + 1;
    myRect.Height = myRect.Bottom - myRect.Top + 1;
    MessageBox.Show(" Left: " + myRect.Left.ToString() + "\n Right: " + myRect.Right.ToString() + "\n Width: " + myRect.Width + "\n Height: " + myRect.Height.ToString() + "\n Top" + myRect.Top + "\n Bottom: " + myRect.Bottom);


    // this is where we will store a snapshot of the screen
    Bitmap bmpScreenshot = new Bitmap(myRect.Width, myRect.Height);


    // creates a graphics object so we can draw the screen in the bitmap (bmpScreenshot)
    Graphics g = Graphics.FromImage(bmpScreenshot);

    // copy from screen into the bitmap we created
    g.CopyFromScreen(myRect.Left, myRect.Top, myRect.Right, myRect.Bottom, bmpScreenshot.Size);


    but when i do picturebox1.image = bmpScreenshot it has nothing to display

    edit* just solved the issue, g.CopyFromScreen(myRect.Left, myRect.Top, 0, 0, bmpScreenshot.Size);
    Last edited by rikkimartin; 08-07-2014 at 12:31 AM.
    Skype: blazikin6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •