Results 1 to 5 of 5

Thread: [RESOLVED] Move PictureBoxes to mouse position, anyone???

  1. #1

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Resolved [RESOLVED] Move PictureBoxes to mouse position, anyone???

    I am writing some source code, that I am required to have two graphic pictureboxes at two different mouse positons. And they are: X and Y.

    Here is my source code, which only has the problem in it:
    Code:
    Public Sub BackGround1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
        If (Y < 0) Or (Y > ScaleHeight) Then
        If (X < 0) Or (X > ScaleWidth) Then
            If GetCapture() Then ReleaseCapture
          Else
            If Not GetCapture() Then SetCapture Me.hwnd
            Form11.TopCursor1.Move Y
            Form11.LeftCursor1.Move X
        End If
        End If
    
    End Sub
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Move PictureBoxes to mouse position, anyone???

    Quote Originally Posted by ThEiMp View Post
    I am writing some source code, that I am required to have two graphic pictureboxes at two different mouse positons. And they are: X and Y.
    Not sure what you mean by that. Also, one position is determined by X *and* Y coordinates. So to have two you'd have to have (x1, y1) and (x2, y2).

  3. #3

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Move PictureBoxes to mouse position, anyone???

    Well I am moving a ruler marker into place. One is X and the other one is Y.
    Can you please show me the code, to do so???

    Really need this. Have been looking on the Internet and this Forum for help, and have come up against nothing much. But that source code, from one of the old threads, on this Forum.

    This code seems to be working, but it must be optimised to run at lower cpu usage rates.
    Code:
    Public Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If (Y < 0) Or (X < 0) Or (Y > ScaleHeight) Or (X > ScaleWidth) Then
            If GetCapture() Then ReleaseCapture
          Else
            If Not GetCapture() Then SetCapture Me.hwnd
            Form11.TopCursor1.Move X
            Form11.LeftCursor1.Move Y
        End If
        
    End Sub
    Last edited by ThEiMp; Apr 2nd, 2010 at 10:59 AM.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Move PictureBoxes to mouse position, anyone???

    Put two lines on the form (lnLeft and lnTop) and use this code. Try to understand the code, this is extremely simple.

    Code:
    Option Explicit
    
    Private Sub Form_Load()
       lnLeft.X1 = 0
       lnLeft.X2 = 120
       lnLeft.Y1 = 0
       lnLeft.Y2 = 0
       
       lnTop.Y1 = 0
       lnTop.Y2 = 120
       lnTop.X1 = 0
       lnTop.X2 = 0
    End Sub
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
       lnLeft.Y1 = Y
       lnLeft.Y2 = Y
       
       lnTop.X1 = X
       lnTop.X2 = X
    End Sub

  5. #5

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Move PictureBoxes to mouse position, anyone???

    The code that you had placed on this thread, worked just fine!!

    Thanks for the help!!
    Last edited by ThEiMp; Apr 2nd, 2010 at 11:17 AM.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

Posting Permissions

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



Click Here to Expand Forum to Full Width