How do I keep my screen resolution,dimentions when resizeing ?? 
Author Message
 How do I keep my screen resolution,dimentions when resizeing ??

Hi there

I want to be able to keep my screen dimentions when resizeing
Or if I run my app on a system with differant screen resolution ?

Can anybody help in doing this
Thanks in advance

Fri, 03 Aug 2001 03:00:00 GMT  
 How do I keep my screen resolution,dimentions when resizeing ??
There are several 3rd-party controls out there that will do this.  The first
one that comes to mind is the Elastic control from Videosoft.

I've also written a class module that does basically the same thing.  It
requires more code on your part but it's free although some would argue
that's about what it's worth I suppose.  Anyway, if you'd like to try it,
I've pasted below.  Hopefully, there's enough in-line documentation in it to
get you started should you decide to use it.  I wrote it a couple of years
ago and haven't looked at it since (which is good...I guess).


Option Explicit
' CStretch class
' This class can be included in any project, and once
' referenced in a form, will resize all the controls
' on the form each time it is resized at run-time.
' Design Considerations
' Fonts
' This class does its best to resize fonts in proportion with
' the controls.  True type fonts resize better than non-true
' type fonts.  For this reason, its strongly recommended that
' true type fonts be used.
' Text-based Controls
' Some controls(like text boxes) height property is restricted
' by the height of the text they contain.  If a form containing
' such a control is resized VERY short, the Stretch method
' may not be able to shrink the control to the correct proportional
' height.  If the user then resizes the form taller, the current,
' INCORRECT height will be used as a basis for the new height.  The
' controls height will out of sync with its original height from
' that point forward.
' Scale Mode
' The CStretch class is designed to work with sizes measured
' in Twips.  If for some reason you change your default
' scale mode to something other than twips during design,
' ensure it's changed to twips when filling in the
' DesignHeight & DesignWidth parameters of the SetUpCStretch
' function call at the beginning of your Form_Load event.
' CStretch Properties
' The class has the following writeable properties with the
' default property(if applicable) noted by an *:
' Mode
'   The mode property tells CStretch how the controls will
'   be resized.  The options are as follows:
'       STRETCH_NONE - don't resize the controls
'       STRETCH_VERT - resize vertically only
'       STRETCH_HORZ - resize horizontally only
'      *STRETCH_BOTH - resize both horizontally & vertically
' DesignWidth
' DesignHeight
'   The DesignWidth & DesignHeight properties tell the class
'   the scale size that the form was designed to run under.  Knowing
'   this information allows the class to resize forms appropriately
'   regardless of whether they initially get larger or smaller(due to
'   the fact that an MDI child form will be resized when it
'   loaded as Windows deems appropriate).
'   The value of these properties should be set to the ScaleHeight
'   and ScaleWidth properties of the form in design mode with the ScaleMode
'   set to 2 - Twips.  If you are designing the form full screen,
'   you can use one of the constants defined in CSCONSTS.BAS.  They
'   are:
'      *WIDTH_1024_768      (for 1024 X 768)
'      *HEIGHT_1024_768
'       WIDTH_800_600       (for 800 X 600)
'       HEIGHT_800_600
'       WIDTH_640_480       (for 640 X 480)
'       HEIGHT_640_480
'   NOTE: the design-time size is the ACTUAL size of your form in
'         design mode, not the resolution your monitor is running
'         at while you design the form
'   You may choose not to use any of the above constants.  You can
'   simply design the form the way you want it.  When you're finished,
'   copy the ScaleWidth & ScaleHeight properties of the form(in twips) to
'   width and height parameters of the call to SetUpCStretch(the
'   last two parameters).  This will resize your form correctly
'   regardless of the opening WindowState or what the user does to it
'   while they are viewing it.
' Background
'   The Background object/property is used to speed the resizing
'   operation by hiding all the controls as they are resized, thus
'   eliminating one screen redraw per control.  To use this feature,
'   place a Picture Box control on the form and add all other
'   controls on top of it.  Before the controls are resized/moved,
'   the picture box will be hidden.  After all controls
'   have been resized, the picture box will be shown.
'   If no background object is used, the user will be able to
'   see each control being redrawn and the process of resizing
'   all controls will increase by an order of magnitude.
'   No background object is required.
' Client
'   The Client object is the form that the class will operate on
'   when it's resized.
' ResizeLabels
'   The ResizeLabels property tells the class whether or not to
'   resize the client labels if the text they contain no longer
'   fits after the label is resized.
'   *The default value is False.
' ResizeFonts
'   The ResizeFonts property tells the class whether or not to
'   resize the fonts along with the controls.
'   Resizing fonts can cause the fonts to look 'jaggie' if they
'   are sized very small or very large.
'   *The default value if True.
' CStretch Methods
' CStretch has one and only one method, the Stretch method. The
' Stretch method handles all control resizing.  It will be
' called from you Form_Resize event.
' Share CSTRETCH.CLS & CSCONSTS.BAS from the MARGIN project
' in SourceSafe.
' Copy the following code into the noted sections
' of a form and customize the parameters as needed.
'  '
'  ' instantiate and customize the CStretch object
'  ' (parameters are: CStretch class variable
'  '                  form name or Me
'  '                  background picture box name(optional)
'  '                  stretch mode(optional, default STRETCH_BOTH)
'  '                  stretch fonts(optional, default True)
'  '                  resize labels(optional, default False)
'  '                  design ScaleHeight(optional, default HEIGHT_1024_768)
'  '                  design ScaleWidth(optional, default WIDTH_1024_768)
'  '
'  Set csForm = New CStretch
'  Call SetUpCStretch(csForm, Me, Picture1, , , , 4185, 8385)
' (COPY INTO THE general declarations SECTION)
'' define new stretch object to handle moving/resizing
'' the controls on the form
'Dim csForm As CStretch
'  '
'  ' resize/move controls when the form size is changed
'  '
'  csForm.Resize
' these variables define the current size of the form
' we're supporting
Private m_ScaleWidth As Single
Private m_ScaleHeight As Single
Private m_DesignWidth As Single
Private m_DesignHeight As Single
' this flag will be used by the Stretch subroutine
' to ensure the necessary objects have been Set
Private m_Initialized As Boolean
' this variable indicates the direction(s) controls can
' be resized
' 0 - no resizing
' 1 - vertical resizing only
' 2 - horizontal resizing only
' 3 - vertical & horizontal resizing
Private m_Mode As Integer
' the object that is being resized
Private m_Client As Object
' the objects contained in m_Client
Private m_ChildObjects() As Object
' The sizes of the controls on the form IF an attempt
' was made to size them smaller than they actually
' would go.  An example of this would be to resize a text
' box to only 10 pixels high.  When the Stretch routine
' sees a case where a control's actual size after resizing
' isn't what it was supposed to be, it stores a
' virtual size in this array and that virtual size
' is used to resize the control later
Private m_VirtualSize() As Integer
' backgound object all the objects on the form should
' reside on, will be hidden when controls are resized
' to reduce screen repaints
Private m_Background As Object
' the programmer can choose to resize label controls
' when the text no longer fits(True) or truncate/wrap
' the text when the test doesn't fit(False)
' the default is False
Private m_ResizeLabels As Boolean
' the programmer can choose to resize fonts
' (some apps and/or fonts don't resize well)
' the default is True
Private m_ResizeFonts As Boolean
' array of controls on the client form
Dim Ctls() As Control
' individual control used in For Each... loops
Dim ctl As Control
' arrays used to hold the original Left, Top
' Width, and Height properties of each control
' on the client form
Dim Ctls_Left() As Single
Dim Ctls_Top() As Single
Dim Ctls_Width() As Single
Dim Ctls_Height() As Single

Dim Ctls_X1() As Single
Dim Ctls_X2() As Single
Dim Ctls_Y1() As Single
Dim Ctls_Y2() As Single
' holds the original font size of each control
Dim Ctls_FontSize() As Single
' variables to hold the original ScaleWidth
' and ScaleHeight properties of the client form
Dim OriginalFormWidth As Single
Dim OriginalFormHeight As Single
' loop counter
Dim x As Integer

Property Set Background(BackgroundObject As Object)
   ' set the object to be used as the form background
   Set m_Background = BackgroundObject
End Property

Property Get Background() As Object
   ' get the current background object
   Background = m_Background
End Property

Property Get DesignHeight() As Single
  ' return the height the form was designed to
  DesignHeight = m_DesignHeight
End Property
Property Let DesignHeight(sngHeight As Single)
  ' the ScaleHeight the form was designed to
  m_DesignHeight = sngHeight
End Property

Property Get DesignWidth() As Single
  ' return the width the form was designed to
  DesignWidth = m_DesignWidth
End ...

read more »

Fri, 03 Aug 2001 03:00:00 GMT  
 How do I keep my screen resolution,dimentions when resizeing ??
Hi  If you do not want to use code, Please download our Agfastform control
( and try it out.  It does what you need and
much more.   Since you are working different resolutions you may also want
to download our FREE tool AgWindowWatch which will let you check screen
resolutions  (no matter what you program in including web) without changing
any system settings.

Todd B -  Agendum Software
** FREE Developer tools for download!  NEW release -  AG Fastform layout
tool just released!

>Hi there

>I want to be able to keep my screen dimentions when resizeing
>Or if I run my app on a system with differant screen resolution ?

>Can anybody help in doing this
>Thanks in advance

Sun, 05 Aug 2001 03:00:00 GMT  
 [ 3 post ] 

 Relevant Pages 

1. How Do I Keep My Screen dimentions When Resizeing ????

2. How Do I Keep My Screen dimentions When Resizeing ????

3. Changing screen resolution in full-screen programs?

4. Changing screen resolution in full-screen programs?

5. Screen coordinates change after changing screen resolution???

6. vbScript - keeping open an InputBox after input has been done

7. What am i doing wrong (resolution)

8. Keeping GUI the same in different resolutions?

9. How to Change Screen Resolution in VBA

10. Screen resolution problem

11. Screen Resolution

12. Screen Resolution


Powered by phpBB® Forum Software