home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / sizeall.cls < prev    next >
Encoding:
Text File  |  1995-07-26  |  1.2 KB  |  40 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "SizeAll"
  6. Attribute VB_Creatable = False
  7. Attribute VB_Exposed = False
  8. Option Explicit
  9.  
  10. Private Const WidthProp = "Width"
  11. Private Const HeightProp = "Height"
  12. Public SizeFlags As Integer '1=Width, 2=Height, 3=Both
  13. Public VBInstance As VBIDE.Application
  14.  
  15. Public Sub AfterClick()
  16. Dim ControlIterator As Object
  17. Dim Control As VBIDE.ControlTemplate
  18. Dim NewWidth As Long
  19. Dim NewHeight As Long
  20. Dim bHaveNewValues As Boolean
  21.     
  22.     'If a property access fails, then just ignore it.
  23.     On Error Resume Next
  24.     
  25.     bHaveNewValues = False
  26.     For Each ControlIterator In VBInstance.ActiveProject.ActiveForm.SelectedControlTemplates
  27.         Set Control = ControlIterator
  28.         With Control.Properties
  29.             If bHaveNewValues Then
  30.                 If SizeFlags And 1 Then .Item(WidthProp) = NewWidth
  31.                 If SizeFlags And 2 Then .Item(HeightProp) = NewHeight
  32.             Else
  33.                 If SizeFlags And 1 Then NewWidth = .Item(WidthProp)
  34.                 If SizeFlags And 2 Then NewHeight = .Item(HeightProp)
  35.                 bHaveNewValues = True
  36.             End If
  37.         End With
  38.     Next
  39. End Sub
  40.