Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Actualización: noviembre 2007
Crea un objeto Stroke a partir de datos de paquete.
Espacio de nombres: Microsoft.Ink
Ensamblado: Microsoft.Ink (en Microsoft.Ink.dll)
Sintaxis
'Declaración
Public Function CreateStroke ( _
packetData As Integer(), _
tabletPropertyDescriptionCollection As TabletPropertyDescriptionCollection _
) As Stroke
'Uso
Dim instance As Ink
Dim packetData As Integer()
Dim tabletPropertyDescriptionCollection As TabletPropertyDescriptionCollection
Dim returnValue As Stroke
returnValue = instance.CreateStroke(packetData, _
tabletPropertyDescriptionCollection)
public Stroke CreateStroke(
int[] packetData,
TabletPropertyDescriptionCollection tabletPropertyDescriptionCollection
)
public:
Stroke^ CreateStroke(
array<int>^ packetData,
TabletPropertyDescriptionCollection^ tabletPropertyDescriptionCollection
)
public Stroke CreateStroke(
int[] packetData,
TabletPropertyDescriptionCollection tabletPropertyDescriptionCollection
)
public function CreateStroke(
packetData : int[],
tabletPropertyDescriptionCollection : TabletPropertyDescriptionCollection
) : Stroke
Parámetros
- packetData
Tipo: array<System.Int32[]
Matriz de datos de paquete que se usó para crear el objeto Stroke.
- tabletPropertyDescriptionCollection
Tipo: Microsoft.Ink.TabletPropertyDescriptionCollection
Colección TabletPropertyDescriptionCollection que describe las propiedades que hay en la matriz packetData.
Valor devuelto
Tipo: Microsoft.Ink.Stroke
El trazo recién creado.
El objeto Stroke recién creado.
Comentarios
El tamaño de la matriz en el parámetro packetData debe ser divisible por el tamaño del parámetro tabletPropertyDescriptionCollection.
Nota
Los dos primeros elementos de cada paquete en el parámetro packetData deben ser X y luego Y. Si X e Y no se especifican en las posiciones primera y segunda, respectivamente, de cada paquete, se produce una excepción ArgumentException.
Ejemplos
En este ejemplo, se crea un trazo que representa una onda de seno irregular a partir de datos de paquete aleatorios. Primero, se obtiene TabletPropertyMetrics para PacketPropertyX e Y con el fin de inicializar TabletPropertyDescriptionCollection con los objetos TabletPropertyDescription para esos tipos PacketProperty. Si se admite NormalPressure en el Tablet PC predeterminado, éste también se agrega a la colección. Luego, se crean los datos de paquete reales y se pasan al método CreateStroke.
Dim allTablets As Tablets = New Tablets()
' get the property metrics for X and Y
Dim MetricX As TabletPropertyMetrics = allTablets.DefaultTablet.GetPropertyMetrics(PacketProperty.X)
Dim MetricY As TabletPropertyMetrics = allTablets.DefaultTablet.GetPropertyMetrics(PacketProperty.Y)
' create the TabletPropertyDescriptionCollection, add X and Y
Dim tpDescCollection As TabletPropertyDescriptionCollection = New TabletPropertyDescriptionCollection()
tpDescCollection.Add(New TabletPropertyDescription(PacketProperty.X, MetricX))
tpDescCollection.Add(New TabletPropertyDescription(PacketProperty.Y, MetricY))
' see if the default tablet supports pressure
Dim supportPressure As Boolean = allTablets.DefaultTablet.IsPacketPropertySupported(PacketProperty.NormalPressure)
' if so, add NormalPressure to TabletPropertyDescriptionCollection
If supportPressure Then
Dim MetricP As TabletPropertyMetrics = allTablets.DefaultTablet.GetPropertyMetrics(PacketProperty.NormalPressure)
tpDescCollection.Add(New TabletPropertyDescription(PacketProperty.NormalPressure, MetricP))
End If
' init random number generator
Dim R As Random = New Random()
' init total PacketCount, slotPerPacket and packet data array
Const PACKET_COUNT As Integer = 250
Dim slotPerPacket As Integer = tpDescCollection.Count
Dim pData((PACKET_COUNT * slotPerPacket) - 1) As Integer
' assign packet values
For k As Integer = 0 To PACKET_COUNT - 1
' assign X - X will increment by 106
pData(k * slotPerPacket) = (k * 106)
' assign Y - Y will be 6000 +- 1500
pData((k * slotPerPacket) + 1) = 6000 + R.Next(-1500, 1500)
' assign Pressure if supported, 25-255
If (supportPressure) Then
pData((k * slotPerPacket) + 2) = R.Next(25, 255)
End If
next
' create the Stroke
mInkOverlay.Ink.CreateStroke(pData, tpDescCollection)
mInkOverlay.AttachedControl.Invalidate()
Tablets allTablets = new Tablets();
// get the property metrics for X and Y
TabletPropertyMetrics MetricX = allTablets.DefaultTablet.GetPropertyMetrics(PacketProperty.X);
TabletPropertyMetrics MetricY = allTablets.DefaultTablet.GetPropertyMetrics(PacketProperty.Y);
// create the TabletPropertyDescriptionCollection, add X and Y
TabletPropertyDescriptionCollection tpDescCollection = new TabletPropertyDescriptionCollection();
tpDescCollection.Add(new TabletPropertyDescription(PacketProperty.X, MetricX));
tpDescCollection.Add(new TabletPropertyDescription(PacketProperty.Y, MetricY));
// see if the default tablet supports pressure
bool supportPressure = allTablets.DefaultTablet.IsPacketPropertySupported(PacketProperty.NormalPressure);
// if so, add NormalPressure to TabletPropertyDescriptionCollection
if (supportPressure)
{
TabletPropertyMetrics MetricP = allTablets.DefaultTablet.GetPropertyMetrics(PacketProperty.NormalPressure);
tpDescCollection.Add(new TabletPropertyDescription(PacketProperty.NormalPressure, MetricP));
}
// init random number generator
Random R = new Random();
// init total PacketCount, slotPerPacket and packet data array
const int PACKET_COUNT = 250;
int slotPerPacket = tpDescCollection.Count;
int[] pData = new int[PACKET_COUNT*slotPerPacket];
// assign packet values
for (int k = 0; k < PACKET_COUNT; k++)
{
// assign X - X will increment by 106
pData[k * slotPerPacket] = (k * 106);
// assign Y - Y will be 6000 +- 1500
pData[(k * slotPerPacket) + 1] = 6000 + R.Next(-1500, 1500);
// assign Pressure if supported, 25-255
if (supportPressure)
{
pData[(k * slotPerPacket) + 2] = R.Next(25, 255);
}
}
// create the Stroke
mInkOverlay.Ink.CreateStroke(pData, tpDescCollection);
mInkOverlay.AttachedControl.Invalidate();
Plataformas
Windows Vista
.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Información de versión
.NET Framework
Compatible con: 3.0
Vea también
Referencia
Microsoft.Ink (Espacio de nombres)
TabletPropertyDescriptionCollection.InkToDeviceScaleX