Results 1 to 12 of 12

Thread: help making user control :[ please

  1. #1
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default help making user control :[ please

    is this written correctly?when i run, the pholder moves down 1 pixel seemingly randomly but at an average speed of like 6 pixels per 2 seconds. also, when i click the mouse(not releaseing it, basicly calling mousedown event) the pholder moves to point 0,0. i dont think i asked it to do that :\ :]

    EDIT: this is supposed to allow me to drag the picture box around during runtime.
    Code:
    Public Class PBox
    
        Property Img() As String
            Set(ByVal value As String)
                PHolder.ImageLocation = Img
            End Set
            Get
                Img = PHolder.ImageLocation
            End Get
        End Property
    
        Private Sub PHolder_Loaded(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles PHolder.LoadProgressChanged
            PHolder.ImageLocation = "C:\Users\josh\Pictures\cgjvbmn.png"
        End Sub
        Public M_Point, ploc, pmove As Point
        Public Downn As Boolean = False
        Public upp As Boolean = False
        Private Sub Mouse_Down(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PHolder.MouseDown, MyBase.MouseDown, ToolStripComboBox1.MouseDown, ToolStripMenuItem1.MouseDown
            M_Point = MousePosition
            Downn = True
            Dim senderer As Object = PHolder
            Dim ee As System.EventArgs
            ee = EventArgs.Empty
            Call PBox_Move(senderer, e)
        End Sub
    
        Private Sub PBox_Move(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PHolder.MouseMove
            If Downn Then PHolder.Location = New Point((PHolder.Location.X + MousePosition.X - M_Point.X) / 2, (PHolder.Location.Y + MousePosition.Y - M_Point.Y) / 2)
        End Sub
    
        Private Sub PHolder_MouseUp(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PHolder.MouseUp
            Downn = False
        End Sub
    End Class
    EDIT: PHolder is a PictureBox
    Last edited by g0tp0t; 05-11-2010 at 03:07 PM.
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  2. #2
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    so if i read this corectly, you basicly want to make the picturebox move to the mouse?
    Kindof Inactive...

  3. #3
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    [Offtopic] How are you not a junior member? You have been here for ~ 2 months and have 376 posts? [/Offtopic]
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

  4. #4
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Quote Originally Posted by cycrosism View Post
    [Offtopic] How are you not a junior member? You have been here for ~ 2 months and have 376 posts? [/Offtopic]
    They have changed things >.>

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  5. #5
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No, i want to be able to drag the picturebox during runtime. :P. didnt think this thread would ever get going. lol

    i used to be spoonbeater8p(horrible name, it was a joke :P) who was here for 3 years over 10 posts and no junior mem. idc. junior mem gives no better benefits. and i now need to be here for 6 months and over 800 posts or something for junior mem :\

    lmao. i like the new rule

    less leachers. i dont like the reg users seeing the junior mem scripts though.

    and to become junior mem you should have to prove you wanna be part of the community. like submit a few scripts or something. nothing like high standards of mem scripts though :P.

    i LOVE SRL. <3
    Last edited by g0tp0t; 05-11-2010 at 03:08 PM.
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  6. #6
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by g0tp0t View Post
    No, i want to be able to drag the picturebox during runtime. :P. didnt think this thread would ever get going. lol
    Ill throw your code into vb, and see what it does, and see what the problem is h/o

    Here you go, i belive i fixed the prob, your calculations were all off. it was going off windows mouse position, not the forms mouse position... lol

    Code:
    Public Class PBox
    
        Property Img() As String
            Set(ByVal value As String)
                PHolder.ImageLocation = Img
            End Set
            Get
                Img = PHolder.ImageLocation
            End Get
        End Property
    
        Private Sub PHolder_Loaded(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles PHolder.LoadProgressChanged
            'PHolder.ImageLocation = "C:\Users\josh\Pictures\cgjvbmn.png"
        End Sub
        Public M_Point, ploc, pmove As Point
        Public Downn As Boolean = False
        Public upp As Boolean = False
        Private Sub Mouse_Down(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PHolder.MouseDown, MyBase.MouseDown
            M_Point = MousePosition
            Downn = True
            Dim senderer As Object = PHolder
            Dim ee As System.EventArgs
            ee = EventArgs.Empty
            Call PBox_Move(senderer, e)
        End Sub
    
        Private Sub PBox_Move(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PHolder.MouseMove
            Dim x, y As Integer
    
            Label4.Text = Me.Location.X & " , " & Me.Location.Y
            x = MousePosition.X - Me.Location.X
            y = MousePosition.Y - Me.Location.Y
    
            Label4.Text = Me.Text & " | " & x & " , " & y
    
            If Downn Then PHolder.Location = New Point(x - (PHolder.Width / 2) - 10, y - (PHolder.Height / 2) - 30)
            Label1.Text = MousePosition.X
            Label2.Text = MousePosition.Y
            Label3.Text = PHolder.Location.X & " , " & PHolder.Location.Y
    
        End Sub
    
        Private Sub PHolder_MouseUp(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PHolder.MouseUp
            Downn = False
        End Sub
    End Class
    All those labels were for debugging purposes
    Kindof Inactive...

  7. #7
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    omg. should have thought of that. tyvm ^_^
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  8. #8
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by g0tp0t View Post
    omg. should have thought of that. tyvm ^_^
    NP lol, at first i was like why isnt this working...?!? it should be =[

    Then when i set the labels to its positon i was like WOW!
    Kindof Inactive...

  9. #9
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lol. i ran it. 1 problem but i think i can fix. it doesnt drag. instead it moves to were your mouse is if the left button is pressed. it also moves to only the center lol. this will be a control i will first use to make a runsecape map. im going to add a function wich creates labels at certain positions in dif zooms. with math :P
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  10. #10
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by g0tp0t View Post
    lol. i ran it. 1 problem but i think i can fix. it doesnt drag. instead it moves to were your mouse is if the left button is pressed. it also moves to only the center lol. this will be a control i will first use to make a runsecape map. im going to add a function wich creates labels at certain positions in dif zooms. with math :P
    ohh yeah, i didnt know the exact use of it so i made it move to the center ;P lol
    Kindof Inactive...

  11. #11
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lol. yup. the zoom isnt going to have preset levels either. i will also add a few functions like zoom to points wich would zoom so all points given can be seen within a 20 pixel margin of the end of the veiw. also it will have searching once i have gotten all the locations of each symbol.l. i will do that with scar
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  12. #12
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    sweet, cant wait to see when its done
    Kindof Inactive...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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