I am using the following code in a small project to resize FORM1 based on the size of the PICTURE1 picture box control.<br>
The form will not resize on its own when the image in the picture box is larger than the initial size of FORM1. If, however I attempt to manually resize the form when the large image is present, the form "jumps" to the correct size without my having to drag its edges all the way out to the desired width and height.<br>
<br>
What is wrong with this code and/or why won't the form automatically resize itself ? Any help is deeply appreciated.<br>
<br>
========== code follows ============<br>
<br>
Private Sub Form_Resize()<br>
<br>
If Picture1.Width < Data1.Width + Command1.Width Then<br>
Form1.Width = Data1.Width + Command1.Width + 500<br>
Else<br>
Form1.Width = Picture1.Width + 500<br>
End If<br>
<br>
Form1.Height = Picture1.Height + 2000<br>
<br>
End Sub<br>
The form will not resize on its own when the image in the picture box is larger than the initial size of FORM1. If, however I attempt to manually resize the form when the large image is present, the form "jumps" to the correct size without my having to drag its edges all the way out to the desired width and height.<br>
<br>
What is wrong with this code and/or why won't the form automatically resize itself ? Any help is deeply appreciated.<br>
<br>
========== code follows ============<br>
<br>
Private Sub Form_Resize()<br>
<br>
If Picture1.Width < Data1.Width + Command1.Width Then<br>
Form1.Width = Data1.Width + Command1.Width + 500<br>
Else<br>
Form1.Width = Picture1.Width + 500<br>
End If<br>
<br>
Form1.Height = Picture1.Height + 2000<br>
<br>
End Sub<br>