Public Sub Resize_Control(ctl As Object, _
Height As Integer, Width As Integer, _ Interval As Integer) Dim i As Integer DoEvents If (ctl.Height = Height And ctl.Width = Width) Then Exit Sub Do Until ctl.Height = Height And ctl.Width = Width If (ctl.Height < Height) Then ctl.Height = ctl.Height + Interval If (ctl.Height > Height) Then ' incase the controls ctl.Height = Height' height goes past 'the desired.. End If ' change it to End If' the desired If (ctl.Height > Height) Then ctl.Height = ctl.Height - Interval If (ctl.Height < Height) Then ctl.Height = Height End If End If If (ctl.Width < Width) Then ctl.Width = ctl.Width + Interval If (ctl.Width > Width) Then ctl.Width = Width End If End If If (ctl.Width > Width) Then ctl.Width = ctl.Width - Interval If (ctl.Width < Width) Then ctl.Width = Width End If End If Loop End Sub Public Sub Move_Control(ctl As Object, Top As Integer, _ Left As Integer, Interval As Integer) Dim i As Integer DoEvents If (ctl.Left = Left And ctl.Top = Top) Then Exit Sub Do Until ctl.Left = Left And ctl.Top = Top If (ctl.Left < Left) Then ctl.Left = ctl.Left + Interval If (ctl.Left > Left) Then ctl.Left = Left End If End If If (ctl.Left > Left) Then ctl.Left = ctl.Left - Interval If (ctl.Left < Left) Then ctl.Left = Left End If End If If (ctl.Top < Top) Then ctl.Top = ctl.Top + Interval If (ctl.Top > Top) Then ctl.Top = Top End If End If If (ctl.Top > Top) Then ctl.Top = ctl.Top - Interval If (ctl.Top < Top) Then ctl.Top = Top End If End If Loop End Sub Inputs:Move_Control: ctl - the control to be moved (textbox, command button, form, etc.) top - the desired top value to be moved to left - the desired left value to be moved to interval - basically the speed of move (the lower, the slower) Resize_Control: ctl - the control to be resized height - the desired height to be resized to width - the desired width to be resized to interval - basically the speed of resize (the lower, the slower) Assumes: Place the code into a module or alter it to place into a form's code. |