|
Imports System.ComponentModel
<DebuggerNonUserCode()> _
Public Class ToStringConverter
Inherits ExpandableObjectConverter
#Region " Methods "
Public Overrides Function CanConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal destinationType As System.Type) As Boolean
Return ((destinationType Is GetType(String)))
End Function
Public Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
If (destinationType Is Nothing) Then
Throw New ArgumentNullException("destinationType")
End If
If (destinationType Is GetType(String)) Then
'BigMarkers converter.
If TypeOf value Is BigMarkers Then
Dim obj As BigMarkers = DirectCast(value, BigMarkers)
Return "{" & obj.Items.Length & "}"
End If
'SmallMarkers converter.
If TypeOf value Is SmallMarkers Then
Dim obj As SmallMarkers = DirectCast(value, SmallMarkers)
Return "{" & obj.Items.Length & "}"
End If
'Symbols converter.
If TypeOf value Is Symbols Then
Dim obj As Symbols = DirectCast(value, Symbols)
Return "{" & obj.Items.Length & "}"
End If
'Hand converter.
If TypeOf value Is Hand Then
Dim obj As Hand = DirectCast(value, Hand)
Return "{" & obj.Style.ToString & "}"
End If
'Center converter.
If TypeOf value Is Center Then
Dim obj As Center = DirectCast(value, Center)
Return obj.PivotalPoint.ToString
End If
End If
Return MyBase.ConvertTo(context, culture, value, destinationType)
End Function
#End Region
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.