home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / ARQS_ZIP / VBPROB.ZIP / VBPROB.TXT
Encoding:
Text File  |  1991-10-18  |  3.6 KB  |  79 lines

  1. Knowledge Base
  2.  
  3. Title: Control Overlaid by Another Control Fails to Refresh if Moved 
  4. Document Number: Q74519           Publ Date: 29-JUL-1991 
  5. Product Name: Microsoft Visual Basic 
  6. Product Version:  1.00 
  7. Operating System: WINDOWS 
  8.  
  9.  Summary: 
  10.  
  11.  Visual Basic does not support overlapping controls. Having overlapping
  12.  controls can result in portions of a control not refreshing correctly. 
  13.  If controls are moved over each other, then one or both of the 
  14.  controls may not correctly refresh even when the controls are moved 
  15.  apart. This is known to happen when controls are resized at run time 
  16.  using the Move method or by changing the Height and Width properties 
  17.  as a result of a Form_Resize event. Because controls must be resized 
  18.  one at a time, it is possible that one control will briefly overlap 
  19.  another control during the resize process at run time. The control 
  20.  that was briefly overlapped may not refresh properly. An example of 
  21.  this behavior is given further below. 
  22.  
  23.  This behavior can be improved by performing the Refresh method 
  24.  (CtrlName.Refresh) on every overlapping control at run time, after an 
  25.  overlapped control has been moved or after a form that contains 
  26.  overlapping controls has been resized. 
  27.  This is not a problem with Visual Basic, but the nature of overlapping 
  28.  controls under Visual Basic. This behavior occurs at run time in the 
  29.  Visual Basic development environment or as an .EXE program. 
  30.  This information applies to the Visual Basic programming system 
  31.  version 1.0 for Windows. 
  32.  
  33.  More Information:
  34.  
  35.  For more information about Visual Basic and overlapping controls,
  36.  query in this knowledge base on the following words: 
  37.  
  38.     overlapping and controls and Visual and Basic
  39.  
  40.  Steps to Reproduce Problem
  41.  -------------------------- 
  42.  
  43.  1. From the File menu, choose New Project (ALT, F, P).
  44.  2. Add a picture control (Picture1) to the default form (Form1). 
  45.  3. Add a command button (Command1) to Form1. 
  46.  4. Add a vertical scroll bar (VScroll1) to Form1. 
  47.  5. Using the mouse, double-click on Form1 to bring up the code 
  48.     window. 
  49.  6. Within the Resize event procedure of Form1, add the following code: 
  50.       Sub Form_Resize () 
  51.           Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, _ 
  52.                         ScaleHeight - Command1.Height 
  53.           VScroll1.Move ScaleWidth - VScroll1.Width, 0, _ 
  54.                         VScroll1.Width, ScaleHeight - Command1.Height 
  55.           Command1.Move 0, ScaleHeight - Command1.Height, _ 
  56.                         ScaleWidth, Command1.Height 
  57.       End Sub 
  58.  Note: The underscores (_) in the above code example indicate that 
  59.  the line should be concatenated with the next line in the Visual Basic 
  60.  environment (VB.EXE). 
  61.  7. Run the program. 
  62.  8. Using the mouse, resize the form by extending the bottom or right 
  63.     sides. When the bottom edge of the form is extended, the command 
  64.     button (Command1) will not refresh. When the right edge of Form1 
  65.     is extended, the scroll bar will not refresh. The refresh problems 
  66.     are caused because Picture1 is expanded and temporarily overlaps 
  67.     the control. When the control (VScroll1 or Command1) is moved out 
  68.     of the way, it is not refreshed. 
  69.  To work around this behavior, use the Refresh method for Picture1, 
  70.  VScroll1, and Command1 after the controls have be moved. Add the 
  71.  following statements to Sub Form_Resize (after the Command1.Move 
  72.  statement) above to overcome the behavior: 
  73.     Picture1.Refresh 
  74.     VScroll1.Refresh 
  75.     Command1.Refresh 
  76.  Additional reference words: 1.00 
  77.  
  78. COPYRIGHT Microsoft Corporation, 1991.
  79.