Width property of form is not what it's set to, though looks OK
The form's borderstyle is "fixed single" so the user cannot alter the form's dimensions manually.
There is a menu item that allows the user to select 1 of 2开发者_如何学JAVA width settings for the form, choosing wide (width = 11715) displays extra controls.
During the load event a sub is called to set various values and which includes this code:
If rs.Fields("ShowAll").Value = True then
Me.Width = 11715
During the form unload event a sub is called to record the settings for the next time and which includes this code:
If Me.Width = 11715 Then
rs.Fields("ShowAll").Value = True
Else
rs.Fields("ShowAll").Value = False
End If
One user has reported a situation where even though he always closes with the form "wide" it always opens "narrow".
I have never seen this happen before and nobody has ever reported it either, which is not to say it's not happening elsewhere.
His machine is windows 7 and his screen resolution is 1280 X 1024.
Edit : Also when I checked his database the value for "ShowAll" is False.
I suggest using a form level boolean variable rather than a specific number. You can also wrap it in a property if you like to make it easier to understand. Initialize the variable with the database value when you load your app and toggle the value when the button is clicked to choose the form size.
Private m_blnExpanded As Boolean
Private Property Let Expanded(ByVal vExpanded As Boolean)
m_blnExpanded = vExpanded
End Property
Private Property Get Expanded() As Boolean
Expanded = m_blnExpanded
End Property
If you are going to hard-code the width then you have to choose a number of twips that is multiple of 15 for small-fonts and multiple of 12 for large-fonts. The least multiple of both is 60, so the closest to your hard-coded value is 11700 which is 780px in small-fonts and 975px in large-fonts exactly.
Mind that win7 comes with more DPI sizes besides 96 (aka "small-fonts") and 120 (aka "large-fonts"), which totally fail VB6 forms subsystem. So you are safe to assume that in VB6 pixel size is either 15 or 12 twips.
精彩评论