Please help! How to handle form events when window is resized?
I'm new to VB 6.0. I really don't know what is the easiest way to handle events, when window is resized by user. Please help.
Here is full form's text from VB, I want to execute
Public Sub formResize()
every time vhen window is resized:)
thanks
Option Explicit
Const BORDER = 120 'Bulgarian constant
Const MIN_WINDOW_SIZE = 4200 'too:)
Private Sub Form_Load()
Resize
rtbStatusList.Text = "30.11.2005 15:24:11 Papiermangel" + vbCr + "30.11.2005 16:55:00 Papierende" + vbCr + "30.11.2005 20:12:11 Keine Verbindung"
rtbStatusList.Text = rtbStatusList.Text + rtbStatusList.Text
rtbStatusList.Text = rtbStatusList.Text + rtbStatusList.Text
End Sub
Private Sub Resize()
On Error Resume Next
End Sub
Public Sub formResize()
Dim w As Integer
Dim h As Integer
w = ScaleWidth
h = ScaleHeight
If (w < MIN_WINDOW_SIZE) Then
w = MIN_WINDOW_SIZE
End If
If (h < MIN_WINDOW_SIZE) Then
h = MIN_WINDOW_SIZE
End If
fraCardInfo.Width = w - picCreditCard.Width - BORDER * 3
fraButtons.Width = w - picCreditCard.Width - BORDER * 3
picCreditCard.Left = w - picCreditCard.Width - BORDER
rtbStatusList.Width = w - BORDER * 2
rtbStatusList.Height = h - rtbStatusList.Top - BORDER
End Sub
Re: Please help! How to handle form events when window is resized?
Isn't there a Form_Resize event in the events combo for your form ¿
Re: Please help! How to handle form events when window is resized?
Where could I find it? I have components on left side and project and properties on the right side of program, but I can't find combo box with events :mad:
Re: Please help! How to handle form events when window is resized?
VB Code:
Private Sub Form_Resize()
Dim w As Integer
Dim h As Integer
w = ScaleWidth
h = ScaleHeight
If (w < MIN_WINDOW_SIZE) Then
w = MIN_WINDOW_SIZE
End If
If (h < MIN_WINDOW_SIZE) Then
h = MIN_WINDOW_SIZE
End If
fraCardInfo.Width = w - picCreditCard.Width - BORDER * 3
fraButtons.Width = w - picCreditCard.Width - BORDER * 3
picCreditCard.Left = w - picCreditCard.Width - BORDER
rtbStatusList.Width = w - BORDER * 2
rtbStatusList.Height = h - rtbStatusList.Top - BORDER
End Sub
Re: Please help! How to handle form events when window is resized?
Thanks a lot, it works good now.
Re: Please help! How to handle form events when window is resized?
The proper way
Not that using the _Resize event doesn't work, it's just a lot less efficient and you get flickering when you try to make the window too small or too large.
Re: Please help! How to handle form events when window is resized?
Using _Resize with limits is really better option, thanks
Re: Please help! How to handle form events when window is resized?
And I'm telling you it isn't the better option, but do as you wish.