How the SizeMode Property and Resize Event InteractThe OLE control's SizeMode property controls how the OLE control displays an OLE object. Table 18.3 lists the possible settings for the SizeMode property. Table 18.3 - SizeMode Property Settings
If the OLE control does not match the size of the OLE object that it contains, Visual Basic triggers a Resize event for the object. The Resize event has the following form for the OLE control: Private Sub OLE1_Resize(HeightNew As Single, WidthNew As Single) ' ... your code here. End Sub The HeightNew and WidthNew arguments indicate a recommended size for the object. This size is that of the OLE object in its original form. You can use these arguments with the SizeMode property to control the scaling of an OLE object. To learn more about this technique, see the section "Scaling the Object to Fit the Control," later in this chapter. The Resize event occurs when the displayed size of an OLE object changes, as in the situations described in Table 18.4. Table 18.4 - Situations That Result in a Resize Event
The Resize event does not occur when SizeMode changes from any setting to vbOLESizeClip or vbOLESizeAutoSize to any setting. In the latter situation, the control size matches the object size, so no visual change occurs, either. |
||||||||||||||||||||||||||||
![]() |
![]() |
|||