Поделиться через


Ink.Load - метод

Обновлен: Ноябрь 2007

Populates a new Ink object with known binary data.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Sub Load ( _
    inkdata As Byte() _
)
'Применение
Dim instance As Ink
Dim inkdata As Byte()

instance.Load(inkdata)
public void Load(
    byte[] inkdata
)
public:
void Load(
    array<unsigned char>^ inkdata
)
public void Load(
    byte[] inkdata
)
public function Load(
    inkdata : byte[]
)

Параметры

  • inkdata
    Тип: array<System.Byte[]
    The byte array that contains the ink data.

Заметки

You can load ink only into a new, empty Ink object—an Ink object that has neither collected any Stroke object nor has any attached properties. If you try to load ink into an Ink object that has collected strokes or attached properties, even if the strokes or properties have been deleted from the Ink object, an exception is thrown. This occurs because of how the Id properties are assigned. A Stroke object is assigned a unique Id property, and this Id property is not reused, even if the Stroke object has been deleted from an Ink object. This means that if an Ink object contained a Stroke with an Id property of 1 and you deleted the Stroke and loaded different ink data into this Ink object, the Id property for any new Stroke object would have to start at 2. Tracking this across numerous Ink objects could lead to errors and is therefore not allowed.

ms569609.alert_note(ru-ru,VS.90).gifПримечание.

If you do attempt to load ink into a an Ink object that is not empty, all data in the Ink object, including any CustomStrokes or ExtendedProperties, is lost when you call the Load method.

The Save method allows you to persist the ink in GIF format, which consists of an array of byte data. The GIF persistence format is specified in the PersistenceFormat enumeration type. After you have the array of byte data, you can load it into another Ink object. This means that you can load GIF-compatible byte array data into another Ink object in the same way as if you had called the Save method and received a byte array that was not in GIF format.

ms569609.alert_note(ru-ru,VS.90).gifПримечание.

You cannot create an image, persist that image as a byte array, and then load that byte array into another Ink object. This is because after you load byte array data as a GIF, Microsoft® Windows® XP Tablet PC Edition cannot control the format of that data; therefore, after you persist the image into a byte array again, you cannot call Load on that data.

Примеры

In this example, saved ink is loaded from a file into the Ink object of an InkOverlay object.

Try
    ' Ink.Load() must work on a new (unused) ink object. 
    ' Otherwise, an exception is raised.
    mInkOverlay.Enabled = False
    mInkOverlay.Ink = New Ink()
    mInkOverlay.Enabled = True
    ' FILE_NAME is a class level const
    Using FS As FileStream = New FileStream(FILE_NAME, FileMode.Open)
        ' read the bytes from the file
        Dim isf(FS.Length) As Byte
        FS.Read(isf, 0, FS.Length)
        ' and load the Ink object
        mInkOverlay.Ink.Load(isf)
    End Using
Catch
    ' handle or rethrow
End Try
try
{
    // Ink.Load() must work on a new (unused) ink object. 
    // Otherwise, an exception is raised.
    mInkOverlay.Enabled = false;
    mInkOverlay.Ink = new Ink();
    mInkOverlay.Enabled = true;
    // FILE_NAME is a class level const
    using (FileStream FS = new FileStream(FILE_NAME, FileMode.Open))
    {
        // read the bytes from the file
        byte[] isf = new byte[FS.Length];
        FS.Read(isf, 0, (int)FS.Length);
        // and load the Ink object
        mInkOverlay.Ink.Load(isf);
    }
}
catch 
{
    // handle or rethrow
}

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

Ink Класс

Ink - члены

Microsoft.Ink - пространство имен

Ink.Save