Valhalla Legends Forums Archive | Battle.net Bot Development | Form_Resize [vb]

AuthorMessageTime
FiReGoD
can anyone help me to find whats wrong with this?
[code]Private Sub Form_Resize()
Const padding = 5 * 15

With txtChannel
.Left = ScaleWidth - .Width - padding
.Top = padding
End With

With cmdSend
.Top = ScaleHeight - .Height - padding
.Left = ScaleWidth - .Width - padding
End With

With txtSend
.Left = padding
.Top = ScaleHeight - padding - .Height
.Width = cmdSend.Left - .Left - padding
.Height = cmdSend.Height
End With

With txtChat
.Left = padding
.Top = padding
.Width = txtChannel.Left - .Left - padding
.Height = txtSend.Top - .Top - padding
End With

With UserList1
'yeah
.Top = txtChannel.Top + txtChannel.Height + padding
.Height = txtSend.Top - .Top - padding
.Width = txtChannel.Width
.Left = ScaleWidth - .Width - padding
End With
End Sub[/code]
March 24, 2003, 9:54 AM
Grok
Not sure what you mean by "what's wrong with this" but I can suggest some changes.

#1. Either add On Error Resume Next, or do some data validation in the procedure. For example, when in txtChannel the rhvalue of ".ScaleWidth (where's the frmName.ScaleWidth?) - .Width - padding is less than 0, you will immediately get a runtime error, invalid procedure call, I believe.

#2. Your code will be much more managable if you use .Move as such:

txtChannel.Move padding, padding, frmBot.ScaleWidth - 2 * padding

#3. It looks like you're trying to put txtChannel and cmdSend at the same Top, Left position.
March 24, 2003, 12:35 PM

Search