Jump to content

  •  

  • iBotModz CBox


    Photo

    Help PictureBox Image


    This topic has been archived. This means that you cannot reply to this topic.
    1 reply to this topic

    #1 codewarrior

    codewarrior

      Recruit

    • Members

    • 2 posts
    • Joined: 17-April 12

    Posted 29 September 2012 - 01:13 AM

    Good day is there any body can help or suggest how to fix my problem.
    I'am creating OCR using PictureBox and Timer Control. My problem is
    when i run my project the picturebox image moving to the right part.
    I want to know if there is any way to display stable my image in picturebox
    Here is my code under timer sub tick.

    Public Class Form1
    
    Dim igrab As Bitmap = New Bitmap(270, 100)
    Dim icap As Graphics = Graphics.FromImage(igrab)
    
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    	 icap.CopyFromScreen(New Point(Me.Location.X + PictureBox1.Location.X + 4, Me.Location.Y + PictureBox1.Location.Y + 30), _
    						 New Point(0, 0), igrab.Size)
    	 PictureBox1.Image = igrab
    End Sub
    
    End Class
    


    Sorry for my bad english :)
    Thank and advance more power..

    #2 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07

    Posted 29 September 2012 - 09:08 AM

    That code looks like its grabbing a portion of the screen everytime the counter ticks? Is that intended as the screen might change. It may be best to move CopyFromScreen outside the tick so it only runs once.

    Why do you have a timer anyway?