View Single Post
Old 05-22-2004, 04:32 PM   #7 (permalink)
[Shaman]
Forum Novice
 
Join Date: Jun 2003
Age: 23
Posts: 134
Send a message via ICQ to [Shaman]
Default

1) because i spent 5 hours trying to get that control on my form, and still failed(blame vs.net)
2) its 99% accurate, its just 1 or 2 pixels off, so its not such a biggy...

lemme paste the code i used:


Code:
    Private Sub show_img(ByVal x As Integer, ByVal y As Integer)
        Dim w As Integer = PictureBox1.Width * 0.75  ' <<< remove * 0.75 to make it not zoom
        Dim h As Integer = PictureBox1.Height * 0.75 ' <<< same
        Dim a As New Bitmap(w, h, Drawing.Imaging.PixelFormat.Format16bppRgb555)
        Dim img As Image = Ultima.Map.Felucca.GetImage(calc(x, w), calc(y, h), w, h, True)
        Dim graph As Graphics = Graphics.FromImage(a)
        Threading.Thread.Sleep(10)
        graph.DrawImage(img, New Point(0, 0))
        Threading.Thread.Sleep(10)
        PictureBox1.Image = a
    End Sub

    Public Function calc(ByVal coord As Integer, ByVal size As Integer) As Integer
        Return CInt((coord / 8) - ((size / 2) / 8))
    End Function

as you see i made it use the width/height of the picturebox you are using to make the coords you specified the center of the picturebox, in stead of the upper left corner...

you don't really need the threading.thread.sleep(10) in it, i used it to make it not lock up on me when im trying to generate the image
[Shaman] is offline   Reply With Quote