Re: Fix the size of a tab control

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks for the effort, Stuart. We were on the same wavelength. I tried
placing two textboxes on the form to report the Top and Left values of the
tab control and they don't seem to update when the command buttons move
beyond their boundries, even though the control does, infact, resize.

<sigh>

Oh well, it's still fun even with the tab control expanding.

And, don't worry about my job, our administration is where I got my sense of
humour from...and I promise to have our database back to normal long before
it effects staff productivity!
--
BJM
ACE Assistant
Gary Allan High School


"Stuart McCall" wrote:

I had a quick play around with your code this morning, but was unable to
prevent the resizing of the tab control. Here's what I tried:

Function MoveIt(strFormName As String, strControlName As String)

'On Error GoTo Proc_Error

Dim iMoveX As Integer
Dim iMoveY As Integer
Dim newLeft As Integer, newTop As Integer
Dim Ctl As Access.Control

Set Ctl = Forms(strFormName).Controls(strControlName)
iMoveX = Int(1000 * Rnd()) - 500
iMoveY = Int(1000 * Rnd()) - 500

again:

newLeft = Ctl.Left + iMoveX
If (newLeft + Ctl.Width) > (TabCtl0.Left + TabCtl0.Width) Then
newLeft = (TabCtl0.Left + TabCtl0.Width) - Ctl.Width
End If
If newLeft < TabCtl0.Left Then newLeft = TabCtl0.Left
Ctl.Left = newLeft

newTop = Ctl.Top + iMoveY
If (newTop + Ctl.Height) > (TabCtl0.Top + TabCtl0.Height) Then
newTop = (TabCtl0.Top + TabCtl0.Height) - Ctl.Height
End If
If newTop < TabCtl0.Top Then newTop = TabCtl0.Top
Ctl.Top = newTop

Beep

'Proc_Exit:
' Exit Function
'Proc_Error:
' Select Case Err.Number
' Case 2100
' iMoveX = -iMoveX
' iMoveY = -iMoveY
' Resume again
' Case Else
' MsgBox "Error " & Err.Number
' Resume Proc_Exit
' End Select

End Function

Maybe you have more time than I do to polish it off, but that's the gist of
what I meant previously.

Good luck, and if you get this implemented I hope you manage to keep your
job ;-)



.


Quantcast