Hi,
I'm new to Visual Basic 2005 (Express Edition) and I' decided to build my own PrintPreviewDialog using the PrintPreviewControl. One of the properties of the PrintPreviewControl is the Zoom Propertie. Unfortunately, the control doesn't provide a ZoomChanged event and I need to know when this propertie is modified (by the user, by the program or by resizing the control).
Is there a way to trigger a ZoomChanged event everytime the value of the Zoom propertie change
I created a new UserControl that inherit from the PrintPreviewControl but I'm not sure where to go from there.

Firing new event in existing control?
LeoXue
m.schlestein
Jweige
Thanks, I tought about that but, in this case, the zoom property already exist and is build in the PrintPreviewControl. I dont have acces to the code of the property Get or property Set and therefore can not raise a event from there.
I'm thinking about adding a new property like this one
This way the old Zoom property still exist but by using the new MyZoom property I'm raising the zoomChanged event. Unfortunately this doesn't triger the event when the zoom property is changed when the control is resize.
What I would like is a way to "monitor" the zoom property value end raise a event when the value change. Is it possible
awperli
TonyTech06
Public Class MyPreviewControl
Inherits PrintPreviewControl
Public Event ZoomChanged(ByVal Sender As Object, ByVal e As EventArgs)
Public Overloads Property Zoom() As Double
Get
Return MyBase.Zoom
End Get
Set(ByVal value As Double)
If Math.Abs(MyBase.Zoom - value) < 1.0E-17 Then Exit Property
MyBase.Zoom = value
RaiseEvent ZoomChanged(Me, New EventArgs)
End Set
End Property
End Class
CHEN YU-TIEN
Actually you would want to use the Shadows keyword instead of the Overloads keyword. For consumers explicitly using your derived type, this would effectively hide the "zoom" property in the base class. Do note that the consumer could still cast the control into a previewcontrol and call the original "zoom" property.
Hope this helps,
Tampa Magnus
That is incorrect. What you are referring to is the "overrides" keyword, not the "overloads" keyword. However, for that to work the property in the base class needs to be marked as "overridable", which I assume is not the case for this control.