Editar

Compartilhar via


StrokeCollectionConverter Class

Definition

Converts a StrokeCollection to a string.

public ref class StrokeCollectionConverter : System::ComponentModel::TypeConverter
public class StrokeCollectionConverter : System.ComponentModel.TypeConverter
type StrokeCollectionConverter = class
    inherit TypeConverter
Public Class StrokeCollectionConverter
Inherits TypeConverter
Inheritance
StrokeCollectionConverter

Examples

The following example demonstrates how to convert a base-64, encoded ISF string to a StrokeCollection. This assumes that there is an InkPresenter called presenter.

// The base-64 encoded string that contains ink data 
// in ink serialized format (ISF).
string strokesString =
    @"AOoFAxBIEEVqGwIAWf9GahsCAFn/GRQyCACAEAIAAABCMwgAgA"
    + "wCAAAAQhWrqtNBq6rTQaVh0MSr+ivFHyEVVFVVVVV1OkBUVVVVVXU6QJ7"
    + "0SZ80DJrAVFVVVVV/pcAKU3yC/gEb+AX/k5Z8PwWBO5KktgJSUAAKjzyC"
    + "wBZYLEoCJLd+Cbti873JlTUvn158doCC/gKb+ApwAJslSywE2ALAAWPPI"
    + "FhKWBKWAKAmwJVglAKACiMjgv3d+8Xi+fHWM2WC0zcm89+NSoL+A5P4Dl"
    + "uNlhFIqpLKAAoaF4L+AhP4CFAWAWCggv4Dc/gNty2yy5SrlKAKIhyC/gI"
    + "b+Ai+JZc2XZOyb46vLQCC/gOL+A5YDNlWFjN3CwAKQFeC/gOr+A7VhUFZ"
    + "KCsS2WTc2SyhKuWVLR3ly2LAXx574ssUgv4Dm/gOcCwEEpUTYSixUsuWy"
    + "gVZ79AQsWGyWUAKLCiC/gQT+BA9SWbllDfGqy3Lcu+OmfH8EIL+BDv4EP"
    + "XLKSpY3lVFhZuVZvKACkFggv4F2/gXlKLFuCVKTcsqUlkoRKBmk8zfFll"
    + "S2ySlACwAgv4Ds/gO+WWWWLBLFllllSksAoSkWG1kSbFu5AoAAAo/YoL+"
    + "Biv4GJJU+P4qSalUBKWdkBYCbm+Nliyk1CVKgCxYNYqC/gQb+BBwO8ABY"
    + "olDz4gAEzaw2AVCUKAsWCooCiAegv4Hw/gfEJe8zUoSgLCC/gNT+A0xM7"
    + "Gdmdliay2VaAo0PoL+B7v4Hx5Yq3lc2xZsseeC3N8aDXjUpWW4UIL+A5P"
    + "4DnhYqAIWFkqpcrLZuJuWqSyxVAovNoL+CJP4IjnlkDvHeSbSVd9FqFlI"
    + "oWAAgv4Dk/gOVc7gbmdyZ1LajFFJmlRKsoAKVXmC/go7+CjdRvredypaK"
    + "myLC7ytZQqFiyWbikAEvfg2pSVKS7liSwWJNsrbi4CC/gQD+A/9M2ACxU"
    + "qKjcVuXKiosCWWKQSyhvKRUUWULCwEmyyu4gA=";
' The base-64 encoded string that contains ink data 
' in ink serialized format (ISF).
Private strokesString As String = _
    "AOoFAxBIEEVqGwIAWf9GahsCAFn/GRQyCACAEAIAAABCMwgAgA" _
    & "wCAAAAQhWrqtNBq6rTQaVh0MSr+ivFHyEVVFVVVVV1OkBUVVVVVXU6QJ7" _
    & "0SZ80DJrAVFVVVVV/pcAKU3yC/gEb+AX/k5Z8PwWBO5KktgJSUAAKjzyC" _
    & "wBZYLEoCJLd+Cbti873JlTUvn158doCC/gKb+ApwAJslSywE2ALAAWPPI" _
    & "FhKWBKWAKAmwJVglAKACiMjgv3d+8Xi+fHWM2WC0zcm89+NSoL+A5P4Dl" _
    & "uNlhFIqpLKAAoaF4L+AhP4CFAWAWCggv4Dc/gNty2yy5SrlKAKIhyC/gI" _
    & "b+Ai+JZc2XZOyb46vLQCC/gOL+A5YDNlWFjN3CwAKQFeC/gOr+A7VhUFZ" _
    & "KCsS2WTc2SyhKuWVLR3ly2LAXx574ssUgv4Dm/gOcCwEEpUTYSixUsuWy" _
    & "gVZ79AQsWGyWUAKLCiC/gQT+BA9SWbllDfGqy3Lcu+OmfH8EIL+BDv4EP" _
    & "XLKSpY3lVFhZuVZvKACkFggv4F2/gXlKLFuCVKTcsqUlkoRKBmk8zfFll" _
    & "S2ySlACwAgv4Ds/gO+WWWWLBLFllllSksAoSkWG1kSbFu5AoAAAo/YoL+" _
    & "Biv4GJJU+P4qSalUBKWdkBYCbm+Nliyk1CVKgCxYNYqC/gQb+BBwO8ABY" _
    & "olDz4gAEzaw2AVCUKAsWCooCiAegv4Hw/gfEJe8zUoSgLCC/gNT+A0xM7" _
    & "Gdmdliay2VaAo0PoL+B7v4Hx5Yq3lc2xZsseeC3N8aDXjUpWW4UIL+A5P" _
    & "4DnhYqAIWFkqpcrLZuJuWqSyxVAovNoL+CJP4IjnlkDvHeSbSVd9FqFlI" _
    & "oWAAgv4Dk/gOVc7gbmdyZ1LajFFJmlRKsoAKVXmC/go7+CjdRvredypaK" _
    & "myLC7ytZQqFiyWbikAEvfg2pSVKS7liSwWJNsrbi4CC/gQD+A/9M2ACxU" _
    & "qKjcVuXKiosCWWKQSyhvKRUUWULCwEmyyu4gA="
// Accepts a string that contains ink data in ink 
// serialized format (ISF) and converts it into a StrokeCollection.
public void LoadStrokes()
{
    StrokeCollectionConverter converter =
        new StrokeCollectionConverter();

    if (converter.CanConvertFrom(typeof(string)))
    {
        StrokeCollection newStrokes =
            (StrokeCollection)converter.ConvertFrom(null, null, strokesString);
        presenter.Strokes.Clear();
        presenter.Strokes.Add(newStrokes);
    }
}
' Accepts a string that contains ink data in ink 
' serialized format (ISF) and converts it into a StrokeCollection.
Public Sub LoadStrokes()

    Dim converter As New StrokeCollectionConverter()

    If converter.CanConvertFrom(GetType(String)) Then
        Dim newStrokes As StrokeCollection

        newStrokes = converter.ConvertFrom(Nothing, Nothing, strokesString)
        presenter.Strokes.Clear()
        presenter.Strokes.Add(newStrokes)

    End If

End Sub

Remarks

The StrokeCollectionConverter converts a StrokeCollection to a string that represents the StrokeCollection in base-64, encoded Ink Serialized Format (ISF). It is useful to store ink data as base-64, encoded ISF when it is not possible to store raw byte data, such as in Web pages.

Constructors

StrokeCollectionConverter()

Initializes a new instance of the StrokeCollectionConverter class.

Methods

CanConvertFrom(ITypeDescriptorContext, Type)

Returns a value that indicates whether the StrokeCollectionConverter can convert an object of a specified type to a StrokeCollection.

CanConvertFrom(Type)

Returns whether this converter can convert an object of the given type to the type of this converter.

(Inherited from TypeConverter)
CanConvertTo(ITypeDescriptorContext, Type)

Returns a value that indicates whether the StrokeCollectionConverter can convert a StrokeCollection to the specified type.

CanConvertTo(Type)

Returns whether this converter can convert the object to the specified type.

(Inherited from TypeConverter)
ConvertFrom(ITypeDescriptorContext, CultureInfo, Object)

Converts the specified object to a StrokeCollection.

ConvertFrom(Object)

Converts the given value to the type of this converter.

(Inherited from TypeConverter)
ConvertFromInvariantString(ITypeDescriptorContext, String)

Converts the given string to the type of this converter, using the invariant culture and the specified context.

(Inherited from TypeConverter)
ConvertFromInvariantString(String)

Converts the given string to the type of this converter, using the invariant culture.

(Inherited from TypeConverter)
ConvertFromString(ITypeDescriptorContext, CultureInfo, String)

Converts the given text to an object, using the specified context and culture information.

(Inherited from TypeConverter)
ConvertFromString(ITypeDescriptorContext, String)

Converts the given text to an object, using the specified context.

(Inherited from TypeConverter)
ConvertFromString(String)

Converts the specified text to an object.

(Inherited from TypeConverter)
ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type)

Converts a StrokeCollection to a string.

ConvertTo(Object, Type)

Converts the given value object to the specified type, using the arguments.

(Inherited from TypeConverter)
ConvertToInvariantString(ITypeDescriptorContext, Object)

Converts the specified value to a culture-invariant string representation, using the specified context.

(Inherited from TypeConverter)
ConvertToInvariantString(Object)

Converts the specified value to a culture-invariant string representation.

(Inherited from TypeConverter)
ConvertToString(ITypeDescriptorContext, CultureInfo, Object)

Converts the given value to a string representation, using the specified context and culture information.

(Inherited from TypeConverter)
ConvertToString(ITypeDescriptorContext, Object)

Converts the given value to a string representation, using the given context.

(Inherited from TypeConverter)
ConvertToString(Object)

Converts the specified value to a string representation.

(Inherited from TypeConverter)
CreateInstance(IDictionary)

Re-creates an Object given a set of property values for the object.

(Inherited from TypeConverter)
CreateInstance(ITypeDescriptorContext, IDictionary)

Creates an instance of the type that this TypeConverter is associated with, using the specified context, given a set of property values for the object.

(Inherited from TypeConverter)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetConvertFromException(Object)

Returns an exception to throw when a conversion cannot be performed.

(Inherited from TypeConverter)
GetConvertToException(Object, Type)

Returns an exception to throw when a conversion cannot be performed.

(Inherited from TypeConverter)
GetCreateInstanceSupported()

Returns whether changing a value on this object requires a call to the CreateInstance(IDictionary) method to create a new value.

(Inherited from TypeConverter)
GetCreateInstanceSupported(ITypeDescriptorContext)

Returns whether changing a value on this object requires a call to CreateInstance(IDictionary) to create a new value, using the specified context.

(Inherited from TypeConverter)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetProperties(ITypeDescriptorContext, Object)

Returns a collection of properties for the type of array specified by the value parameter, using the specified context.

(Inherited from TypeConverter)
GetProperties(ITypeDescriptorContext, Object, Attribute[])

Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.

(Inherited from TypeConverter)
GetProperties(Object)

Returns a collection of properties for the type of array specified by the value parameter.

(Inherited from TypeConverter)
GetPropertiesSupported()

Returns whether this object supports properties.

(Inherited from TypeConverter)
GetPropertiesSupported(ITypeDescriptorContext)

Returns whether this object supports properties, using the specified context.

(Inherited from TypeConverter)
GetStandardValues()

Returns a collection of standard values from the default context for the data type this type converter is designed for.

(Inherited from TypeConverter)
GetStandardValues(ITypeDescriptorContext)

Returns a collection of standard values for the data type this type converter is designed for when provided with a format context.

(Inherited from TypeConverter)
GetStandardValuesExclusive()

Returns whether the collection of standard values returned from GetStandardValues() is an exclusive list.

(Inherited from TypeConverter)
GetStandardValuesExclusive(ITypeDescriptorContext)

Returns whether the collection of standard values returned from GetStandardValues() is an exclusive list of possible values, using the specified context.

(Inherited from TypeConverter)
GetStandardValuesSupported()

Returns whether this object supports a standard set of values that can be picked from a list.

(Inherited from TypeConverter)
GetStandardValuesSupported(ITypeDescriptorContext)

Returns whether this object supports a standard set of values that can be picked from a list, using the specified context.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
IsValid(ITypeDescriptorContext, Object)

Returns whether the given value object is valid for this type and for the specified context.

(Inherited from TypeConverter)
IsValid(Object)

Returns whether the given value object is valid for this type.

(Inherited from TypeConverter)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
SortProperties(PropertyDescriptorCollection, String[])

Sorts a collection of properties.

(Inherited from TypeConverter)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to