Results 1 to 5 of 5

Thread: RE-POSITIONING Avatars in Client

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2008
    Posts
    27

    RE-POSITIONING Avatars in Client

    I am in need of some help. I have asked here before but never got a correct solution to my problem.

    I'm in need of some help to keep multiple picture boxes aka avatars in their positions as the form is re-sized.

    You can view an image of the client below....



    As you notice the avatars positions... I need them to remain in those positions no matter what resolution the client is at.

    Thanks.

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

    Re: RE-POSITIONING Avatars in Client

    Can you elaborate on "those positions"? The two on the right you want to stick to the right edge, but what should happen with the others? As the main screen gets bigger should they reposition proportionally (by percentage) or what? Maybe you can attach another image with the window much larger showing the avatars at positions you want them at.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2008
    Posts
    27

    Re: RE-POSITIONING Avatars in Client

    Yes, they will re-position proportionally with percentages always remaining in the same position on the screen. Basically they will move, however they will still be seen in the same position on the screen as they were before no matter the size of the client window.

    I would have some code for you to look at, but I don't even know where to start with this kind of function. (sadly)

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

    Re: RE-POSITIONING Avatars in Client

    Lets say the checkered background container is called picBack, the two on the right are called picAvatar1 and picAvatar2. Those are easy, on Form_Resize you simply do

    Code:
    'before this you need to resize picBack too in relation to form's width
    
    picAvatar1.Left = picBack.Width - picAvatar1.Width
    picAvatar2.Left = picBack.Width - picAvatar2.Width
    For the others you need to decide ahead of time where they will be placed percentage wise. If the user can drag and drop it into position, after dropping you would do something like this to get the value (this is the same for all of them so I'll just use a picAvatarA as an example.

    Code:
    'since we need to keep a different value for each avatar, we'll utilize the Tag property to keep it there
    picAvatarA.Tag = Int((picAvatarA.Left * 100) / picBack.Width)
    
    'then in form resize you use that like this
    picAvatarA.Left = picBack.Width * Val(picAvatarA.Tag) / 100

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2008
    Posts
    27

    Re: RE-POSITIONING Avatars in Client

    You're the man.. I have it working for the client side avatar, but not for the others.... Here's what I have.

    Code:
    Private Sub picAv_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
     On Local Error Resume Next
     If Button = vbLeftButton And Chatter(0).userID = Index Then
        
        mMove.EndIt
        
        picAv(Chatter(0).userID).MousePointer = vbDefault
        AddToINI App.Path & "\Data\Settings.ini", "myXY", "  myXY", picAv(Chatter(0).userID).Top & Chr$(58) & picAv(Chatter(0).userID).Left
        
        Chatter(0).userY = picAv(0).Top
        Chatter(0).userX = picAv(0).Left
        
        Chatter(0).userYOld = Int((picAv(Chatter(0).userID).Top * 100) / picBox.Height)
        Chatter(0).userXOld = Int((picAv(Chatter(0).userID).Left * 100) / picBox.Width)
        
        doSend picAv(Chatter(0).userID).Left & Chr$(58) & picAv(Chatter(0).userID).Top, user_Move
    
     End If
    End Sub
    
    Private Sub Form_Resize()
     If Me.WindowState <> vbMinimized Then resizeForm
     
        If Chatter(0).userID <> "" Then
           picAv(Chatter(0).userID).Top = picBox.Height * Val(Chatter(0).userYOld) / 100
           picAv(Chatter(0).userID).Left = picBox.Width * Val(Chatter(0).userXOld) / 100
        End If
        
        For l = 1 To picAv.ubound
            If l <> Chatter(0).userID Then
               picAv(l).Top = picBox.Height * Val(Chatter(l).userYOld) / 100
               picAv(l).Left = picBox.Width * Val(Chatter(l).userXOld) / 100
            End If
        Next
    End Sub
    
            '''' AVATAR MOVEMENTS ''''
            Case liveProtocol & Chr$(user_Move)
                 Dim moveArray() As String
                     moveArray() = Split(Mid$(sckBuffer, 5), Chr(58))
                                      
                     picAv(moveArray(1)).Move moveArray(2), moveArray(3)
                     
                     Chatter(moveArray(1)).userY = picAv(moveArray(1)).Top
                     Chatter(moveArray(1)).userX = picAv(moveArray(1)).Left
                     
                     Chatter(moveArray(1)).userYOld = Int((picAv(moveArray(1)).Top * 100) / picBox.Height)
                     Chatter(moveArray(1)).userXOld = Int((picAv(moveArray(1)).Left * 100) / picBox.Width)
                     
                     checkAvatar moveArray(1)
                     
                     Erase moveArray()
    Last edited by Word; Oct 16th, 2010 at 10:59 PM.

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