Occurs when the value of the
ImageUrl property changes.
Syntax
Visual Basic (Declaration) | |
---|
Public Event ImageUrlChanged() As EventHandler |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As ImageViewer
Dim handler As EventHandler
AddHandler instance.ImageUrlChanged, handler
|
Managed Extensions for C++ | |
---|
public: __event EventHandler* ImageUrlChanged(); |
Example
Visual Basic | Copy Code |
---|
Public Class MyImageViewer
Inherits ImageViewer
Protected Overrides Sub OnImageUrlChanged(ByVal e As EventArgs)
MyBase.OnImageUrlChanged(e)
Console.WriteLine("OnImageUrlChanged is called")
End Sub
Protected Overrides Sub OnImageSizeChanged(ByVal e As EventArgs)
MyBase.OnImageSizeChanged(e)
Console.WriteLine("OnImageSizeChanged is called")
End Sub
Protected Overrides Sub OnScaleFactorChanged(ByVal e As EventArgs)
MyBase.OnScaleFactorChanged(e)
Console.WriteLine("OnScaleFactorChanged is called")
End Sub
Protected Overrides Sub OnSizeModeChanged(ByVal e As EventArgs)
MyBase.OnSizeModeChanged(e)
Console.WriteLine("OnSizeModeChanged is called")
End Sub
Protected Overrides Sub OnHorizontalAlignModeChanged(ByVal e As EventArgs)
MyBase.OnHorizontalAlignModeChanged(e)
Console.WriteLine("OnHorizontalAlignModeChanged is called")
End Sub
Protected Overrides Sub OnVerticalAlignModeChanged(ByVal e As EventArgs)
MyBase.OnVerticalAlignModeChanged(e)
Console.WriteLine("OnVerticalAlignModeChanged is called")
End Sub
Protected Overrides Sub OnScrollBarSizeChanged(ByVal e As EventArgs)
MyBase.OnScrollBarSizeChanged(e)
Console.WriteLine("OnScrollBarSizeChanged is called")
End Sub
Protected Overrides Sub OnResourcesPathChanged(ByVal e As EventArgs)
MyBase.OnResourcesPathChanged(e)
Console.WriteLine("OnResourcesPathChanged is called")
End Sub
End Class
Public Sub TestMyImageViewer()
Dim myViewer As MyImageViewer = New MyImageViewer()
AddHandler myViewer.ImageUrlChanged, AddressOf myViewer_ImageUrlChanged
AddHandler myViewer.ImageSizeChanged, AddressOf myViewer_ImageSizeChanged
AddHandler myViewer.ScaleFactorChanged, AddressOf myViewer_ScaleFactorChanged
AddHandler myViewer.SizeModeChanged, AddressOf myViewer_SizeModeChanged
AddHandler myViewer.HorizontalAlignModeChanged, AddressOf myViewer_HorizontalAlignModeChanged
AddHandler myViewer.VerticalAlignModeChanged, AddressOf myViewer_VerticalAlignModeChanged
AddHandler myViewer.ScrollBarSizeChanged, AddressOf myViewer_ScrollBarSizeChanged
AddHandler myViewer.ResourcesPathChanged, AddressOf myViewer_ResourcesPathChanged
myViewer.ImageUrl = "http://leadtools.com/images/15-homepg-banner.jpg"
myViewer.ImageSize = New Size(765, 235)
myViewer.ScaleFactor = 150
myViewer.SizeMode = ImageViewerSizeMode.Normal
myViewer.HorizontalAlignMode = ImageViewerAlignMode.Center
myViewer.VerticalAlignMode = ImageViewerAlignMode.Center
myViewer.ScrollBarSize = 16
myViewer.ResourcesPath = "/Resources/"
End Sub
Sub myViewer_ImageUrlChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As MyImageViewer = CType(sender, MyImageViewer)
If Not viewer Is Nothing Then
Console.WriteLine("ImageUrl Changed to " & viewer.ImageUrl)
End If
End Sub
Sub myViewer_ImageSizeChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As MyImageViewer = CType(sender, MyImageViewer)
If Not viewer Is Nothing Then
Console.WriteLine("ImageSize Changed to " & viewer.ImageSize.ToString())
End If
End Sub
Sub myViewer_ScaleFactorChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As MyImageViewer = CType(sender, MyImageViewer)
If Not viewer Is Nothing Then
Console.WriteLine("ScaleFactor Changed to " & viewer.ScaleFactor.ToString())
End If
End Sub
Sub myViewer_SizeModeChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As MyImageViewer = CType(sender, MyImageViewer)
If Not viewer Is Nothing Then
Console.WriteLine("SizeMode Changed to " & viewer.SizeMode.ToString())
End If
End Sub
Sub myViewer_HorizontalAlignModeChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As MyImageViewer = CType(sender, MyImageViewer)
If Not viewer Is Nothing Then
Console.WriteLine("HorizontalAlignMode Changed to " & viewer.HorizontalAlignMode.ToString())
End If
End Sub
Sub myViewer_VerticalAlignModeChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As MyImageViewer = CType(sender, MyImageViewer)
If Not viewer Is Nothing Then
Console.WriteLine("VerticalAlignMode Changed to " & viewer.VerticalAlignMode.ToString())
End If
End Sub
Sub myViewer_ScrollBarSizeChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As MyImageViewer = CType(sender, MyImageViewer)
If Not viewer Is Nothing Then
Console.WriteLine("ScrollBarSize Changed to " & viewer.ScrollBarSize.ToString())
End If
End Sub
Sub myViewer_ResourcesPathChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As MyImageViewer = CType(sender, MyImageViewer)
If Not viewer Is Nothing Then
Console.WriteLine("ResourcesPath Changed to " & viewer.ResourcesPath)
End If
End Sub |
C# | Copy Code |
---|
public class MyImageViewer : ImageViewer { //. //. //. protected override void OnImageUrlChanged(EventArgs e) { base.OnImageUrlChanged(e); Console.WriteLine("OnImageUrlChanged is called"); } protected override void OnImageSizeChanged(EventArgs e) { base.OnImageSizeChanged(e); Console.WriteLine("OnImageSizeChanged is called"); } protected override void OnScaleFactorChanged(EventArgs e) { base.OnScaleFactorChanged(e); Console.WriteLine("OnScaleFactorChanged is called"); } protected override void OnSizeModeChanged(EventArgs e) { base.OnSizeModeChanged(e); Console.WriteLine("OnSizeModeChanged is called"); } protected override void OnHorizontalAlignModeChanged(EventArgs e) { base.OnHorizontalAlignModeChanged(e); Console.WriteLine("OnHorizontalAlignModeChanged is called"); } protected override void OnVerticalAlignModeChanged(EventArgs e) { base.OnVerticalAlignModeChanged(e); Console.WriteLine("OnVerticalAlignModeChanged is called"); } protected override void OnScrollBarSizeChanged(EventArgs e) { base.OnScrollBarSizeChanged(e); Console.WriteLine("OnScrollBarSizeChanged is called"); } protected override void OnResourcesPathChanged(EventArgs e) { base.OnResourcesPathChanged(e); Console.WriteLine("OnResourcesPathChanged is called"); } } void myViewer_ImageUrlChanged(object sender, EventArgs e) { MyImageViewer viewer = (MyImageViewer)sender; if(viewer != null) Console.WriteLine("ImageUrl Changed to " + viewer.ImageUrl); } void myViewer_ImageSizeChanged(object sender, EventArgs e) { MyImageViewer viewer = (MyImageViewer)sender; if(viewer != null) Console.WriteLine("ImageSize Changed to " + viewer.ImageSize.ToString()); } void myViewer_ScaleFactorChanged(object sender, EventArgs e) { MyImageViewer viewer = (MyImageViewer)sender; if(viewer != null) Console.WriteLine("ScaleFactor Changed to " + viewer.ScaleFactor.ToString()); } void myViewer_SizeModeChanged(object sender, EventArgs e) { MyImageViewer viewer = (MyImageViewer)sender; if(viewer != null) Console.WriteLine("SizeMode Changed to " + viewer.SizeMode.ToString()); } void myViewer_HorizontalAlignModeChanged(object sender, EventArgs e) { MyImageViewer viewer = (MyImageViewer)sender; if(viewer != null) Console.WriteLine("HorizontalAlignMode Changed to " + viewer.HorizontalAlignMode.ToString()); } void myViewer_VerticalAlignModeChanged(object sender, EventArgs e) { MyImageViewer viewer = (MyImageViewer)sender; if(viewer != null) Console.WriteLine("VerticalAlignMode Changed to " + viewer.VerticalAlignMode.ToString()); } void myViewer_ScrollBarSizeChanged(object sender, EventArgs e) { MyImageViewer viewer = (MyImageViewer)sender; if(viewer != null) Console.WriteLine("ScrollBarSize Changed to " + viewer.ScrollBarSize.ToString()); } void myViewer_ResourcesPathChanged(object sender, EventArgs e) { MyImageViewer viewer = (MyImageViewer)sender; if(viewer != null) Console.WriteLine("ResourcesPath Changed to " + viewer.ResourcesPath.ToString()); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also