home *** CD-ROM | disk | FTP | other *** search
- SIZ Custom Control Version 1.00 for Microsoft Visual Basic V1.0 and V2.0
- (C) February 1993 by W. Raike
-
- **** THIS SOFTWARE IS DISTRIBUTED AS SHAREWARE. IT IS NOT FREE!
- **** IF YOU USE IT FOR MORE THAN A REASONABLE EVALUATION PERIOD,
- **** YOU ARE REQUIRED TO REGISTER AND PAY FOR IT. SEE THE FILE
- **** REGISTER.TXT ACCOMPANYING THIS FILE FOR INFORMATION ON HOW TO
- **** REGISTER AND THE ADVANTAGES OF REGISTERING.
-
- // BRIEF DESCRIPTION:
-
- SIZ lets you add controls to your Visual Basic forms that a user
- can resize at run time by dragging corner "handles", or move by
- dragging, without writing code. SIZ controls also have some of the features
- of Picture Box controls in VB 1.0 or Image controls in VB 2.0. Since
- you can use these features to allow users to easily move and resize
- other Visual Basic controls at runtime, you might want to use SIZ to
- help create WYSIWYG form-design applications, or user-interface
- design tools in the spirit of Visual Basic itself, to name just two
- possible applications. The enclosed demonstration programs give
- several examples; let me know what you can do with SIZ!
-
- // INSTALLATION
-
- The easiest way to install SIZ is to simply copy the file SIZ.VBX to
- your Visual Basic directory. Then, in order to include SIZ on your
- Visual Basic toolbar, use the Add File command on Visual Basic's File
- menu. (Ctrl-F12 in VB 1.0, or Ctrl-D in VB 2.0) If you make your
- application into an EXE file, you will need to distribute SIZ.VBX
- along with the EXE file and Visual Basic's runtime DLL (VBRUN100.DLL
- or VBRUN200.DLL), and SIZ.VBX will also need to be copied into either
- the user's WINDOWS\SYSTEM directory or into the same directory as
- your application's EXE file.
-
- Registered users will receive, in addition to their registered copy
- of SIZ, an additional royalty-free runtime-only version of SIZ.VBX
- which they can distribute along with their EXE applications. The
- runtime-only version does not show the pop-up copyright message box
- that is displayed when this shareware version is loaded, and the
- registered version (intended for design-time use) shows only an
- unobtrusive copyright window that disappears by itself after about
- two seconds.
-
- // SYSTEM REQUIREMENTS
-
- SIZ is a custom control that works under Visual Basic. SIZ supports
- versions 1.0 and 2.0 of Visual Basic for Windows running under
- Microsoft Windows 3.0 or later. (It works much better with version
- 2.0 of VB.) SIZ is useless without a mouse.
-
- // FEATURES:
-
- 1. Handles
-
- SIZ lets you create controls that can have "sizing handles" at
- all four corners, and an optional border. The handles look similar to
- the ones Visual Basic displays at design time, but they function at
- run time. A user can resize the control simply by dragging a corner
- handle to a new position. Handles can be disabled either at design
- time or under program control by setting the Handles property to
- False. When the Handles property is set to True (the default), black
- handles (small squares) appear at the corners of the control, and the
- mouse cursor changes whenever the user moves the mouse over a corner
- handle to indicate that dragging a corner will resize the control.
-
- 2. Automove property
-
- By setting the Automove property to True (the default), you allow a
- user to automatically move the control anywhere on your form by
- dragging it with the mouse and then dropping it (releasing the mouse
- button) at any desired position. This saves you the hassle of
- writing code to implement drag-and-drop movement for one or more
- controls. (For this to work, the control's DragMode property must
- also be set to Manual, which is the default. With DragMode set to
- Automatic, Visual Basic dragging operates normally.)
-
- 3. Picture property
-
- You can load any bitmap into a SIZ control's Picture property, either
- at design time by setting the Picture property to the name of a valid
- bitmap or at runtime by calling Visual Basic's LoadPicture function.
- When a user resizes a SIZ control by dragging one of the corner
- handles, any bitmap currently assigned to the Picture property of the
- control is automatically stretched or compressed to fit the new
- dimensions of the control. Under Visual Basic 2.0 or later, SIZ
- includes support for 256-color bitmaps when the appropriate hardware
- is present. [Note: The author does not yet have access to 256-color
- display hardware to test the latter feature adequately.]
-
- 4. Resize event
-
- You can respond to a user's actions in resizing or moving a SIZ
- control. Immediately after the user has released the mouse button
- after such an action, Visual Basic fires a Resize event for the
- control. You can write code in the control's Resize event procedure
- to handle the event. The Corner parameter to the Resize event
- procedure indicates what corner was moved: 0 indicates no corner
- (i.e., drag-and-drop using Automove); 1, 2, 3 and 4 indicate the
- northwest, northeast, southeast and southwest corners, respectively.
-
- 5. Background color
-
- When no bitmap is loaded into a SIZ control's Picture property, you
- can set the BackColor property to color the control rectangle any
- color you wish.
-
- 6. Drawing or creating graphic images in a SIZ control
-
- Although you can't use graphics methods to directly draw on a SIZ
- control, you can do so in a Picture Box control (say, Picture1) whose
- AutoRedraw property is set to true, and then use the statement
- Siz1.Picture = Picture1.Image to transfer the contents of the Picture
- Box to the SIZ control, where they are retained and can be moved or
- resized at runtime in the normal way.
-
- 7. Superimposing or overlapping SIZ controls
-
- Under Visual Basic 2.0 or later, where they are implemented as
- graphical controls, SIZ controls can be superimposed or overlapped in
- any way you like, and layers of superimposed or overlapped graphical
- images are under full program control using the Zorder method.
- Visual Basic 1.0 does not always display superimposed or overlapped
- controls correctly. (For example, try overlapping two Picture Box
- controls with different background colors in various ways at design
- time and see what happens at runtime!) Since an attempt by a user to
- overlap or superimpose several SIZ controls at runtime under Visual
- Basic 1.0 can have confusing results, you may wish to inhibit such
- actions by using appropriate Visual Basic code, for instance by
- responding to the Resize event to inhibit or undo a resize or drag-
- drop operation. (See the accompanying demonstration program VB1DEMO
- for an example of how to do this; you can run it under either VB 1.0
- or 2.0.) Alternatively, you can use overlapped controls creatively
- to allows users to move and resize other, conventional Visual Basic
- controls, thus duplicating some of the functionality of Visual Basic
- itself. See the demonstration programs VB1DEMO and VB2DEMO for
- examples of how to do this.
-
- 8. Corner property
-
- The Corner property, which is a read-only property, indicates when
- the user moves the mouse over a corner handle. You can use the value
- of this property, typically during a MouseMove event, to obtain
- further information about the status of the mouse within or over the
- control even while a user is resizing or moving it. A Corner
- property value of 0 indicates that the mouse is not over a corner
- handle; values of 1, 2, 3 and 4 indicate the northwest, northeast,
- southeast and southwest corners respectively.
-
- 9. ScaleMode property
-
- SIZ supports all standard ScaleMode values except for 0 (user-defined
- scale mode), so you can set the control's ScaleMode property to match
- that of its container, ensuring proper resize and drag-drop
- (Automove) operation. Note that failure to ensure that the control's
- ScaleMode property matches that of its form or container control will
- cause strange results during resizing or dragging.
-
- //QUIRKS
-
- 1. Combinations of events
-
- At run time, when a user resizes a SIZ control (or moves it in
- Automove mode), MouseDown, MouseMove and MouseUp events are generated,
- in addition to a Resize event. The control "captures" the mouse
- during these operations, so the control generates MouseMove, MouseUp
- and Resize events even though the mouse may be outside the initial
- boundaries of the control when these events take place. However, a
- Click event may or may not be generated, depending upon whether the
- position of the mouse when the mouse button is released is inside or
- outside the starting position of the control; that is, the boundaries
- of the control before the resize or move operation began.
-
- 2. Sequence of events
-
- At run time, when a user resizes a SIZ control (or moves it in
- Automove mode), the sequence in which events are generated is as
- follows:
- MouseDown
- MouseMove (any number of these)
- Resize
- MouseUp
- Click (may or may not occur; see above discussion)
-
- 3. Drag outline during Automove
-
- While a user is resizing a control (or moving it in Automove mode),
- a rectangular outline indicating the control's new position is
- displayed. This works properly under Visual Basic 2.0, but under
- Visual Basic 1.0 only the portion of the outline falling outside the
- initial boundaries of the control (and of other controls) will be
- visible. This may be disconcerting while "shrinking" a control under
- VB 1.0; the mouse cursor does, however, correctly indicate the
- position into which the control is being moved or resized. You
- really should consider upgrading to VB 2.0 (or 3.0)!
-
- // COPYRIGHT INFORMATION
-
- International copyright, intellectual property rights and other
- rights reserved for this program and all associated documentation by:
-
- William Raike
- 66 Simpson Rd.
- Swanson
- Auckland 8SW
- NEW ZEALAND
-
- The author makes no warranties, express or implied, oral or written,
- including any implied warranties of merchantability or fitness for a
- particular purpose. In no event shall the author be liable for any
- damages whatsoever arising out of the use of either the shareware or
- registered versions of this software.
-
- See the file REGISTER.TXT accompanying this file for additional
- information and restrictions regarding copying and distribution of
- this software and all associated documentation.
-
- SIZ was written in C using Borland C++ 3.0, and developed under
- Microsoft MS-DOS 5.0 and Microsoft Windows 3.1 using Microsoft Visual
- Basic Version 1.0 with the Control Development Kit, and Visual Basic
- Version 2.0 Professional Edition. It has also been tested under
- MS-DOS Version 6.0.
-
- SIZ is not compatible with Microsoft Visual C++ Version 1.0 due to
- inherent limitations of that product.
-