-
Avatars
I need an avatar position retention method to save where a user's avatar is, relative to the screen width/height, so when the window is resized, the user's avatar will stay in the same position that it was in before the window was resized either smaller or larger.
-
Re: Avatars
What is the avatar contained in? A picturebox on a form? Need more information
-
Re: Avatars
They're contained inside one bigger picturebox, I will post a screenshot of my client below.
http://i37.tinypic.com/x0s8y8.png
-
Re: Avatars
Ok but when the form is resized you want the avatar to stay where? Why would it move if you resize the form?
-
Re: Avatars
Well say theres like 20 people logged in, their avatars in all different positions, and when the client is resized i want each av to retain the position they're in depending on the size, for instance i'm in the middle with it maximized in the screenshot, but if i normalize it and resize the form i want my avatar to stay in the center. Same as if there was more avatars, they would all remain in the same spot no matter what size the container is.
Does that make sense? lol
-
Re: Avatars
[color=navy]Soulds like maybe you should be using a ListView in large icon view instead. It would be alot easier as it has built in alignment properties.
If not, then you will have to save the location of each avatar and position as you desire.
-
Re: Avatars
I have to use a picture box, because the avatars are moveable. I know that I need to store each of their positions, but I need help doing so, and then keeping them in the position. I suck at math, and have tried everything, but get horrible results.
-
Re: Avatars
So far I have come up with the code below, but I cannot get it working correctly. It keeps my avatar in position for the most part, but there seems to be a problem with correcting the old position of the other avatars...
Code:
Dim tmpVarY As Long, tmpVarX As Long, boxLarger As Boolean
boxLarger = False
If picBoxHeight < .picBox.Height Then
tmpVarY = .picBox.Height - picBoxHeight
boxLarger = True
Else
tmpVarY = picBoxHeight - .picBox.Height
End If
If picBoxWidth < .picBox.Width Then
tmpVarX = .picBox.Width - picBoxWidth
boxLarger = True
Else
tmpVarX = picBoxWidth - .picBox.Width
End If
For i = 0 To .picAv.UBound
.picAv(i).Top = IIf(boxLarger = True, Chatter(i).userY + tmpVarY, Chatter(i).userY - tmpVarY)
.picAv(i).Left = IIf(boxLarger = True, Chatter(i).userX + tmpVarX, Chatter(i).userX - tmpVarX)
If .picAv(i).Left + .picAv(i).Width >= .picBox.Width Then
.picAv(i).Left = .picBox.Width - .picAv(i).Width
End If
If .picAv(i).Top + .picAv(i).Height >= .picBox.Height Then
.picAv(i).Top = .picBox.Height - .picAv(i).Height
End If
If .picAv(i).Top > Chatter(i).userYOld Then
.picAv(i).Top = Chatter(i).userYOld
End If
If .picAv(i).Left > Chatter(i).userXOld Then
.picAv(i).Left = Chatter(i).userXOld
End If
Chatter(i).userY = .picAv(i).Top
Chatter(i).userX = .picAv(i).Left
frmMain.checkAvatar i
Next i
-
Re: Avatars
Code:
Dim Item1 As Long
Dim Item2 As Long
Form1.Picture1.Top = Item1
Form1.Picture1.Left = Item2
-
Re: Avatars
-
Re: Avatars
To make the PictureBox retain its position, when you have resized the Form. You have to maybe look into the ScaleWidth and ScaleHeight properties, in the Form_Resize handler. You have to set them at run-time, and set values to them.