有人知道我怎么称呼它? 公共结构SmiAccelerometerVector { 公共浮动x; 公共浮动y; 公共浮动z; }
我想获取x,y,z值并将其粘贴到标签中。
答案 0 :(得分:0)
Samsung's documentation对包含这些函数的确切DLL不清楚,但我相信它看起来像这样:
public struct Vector
{
Single X;
Single Y;
Single Z;
}
[DllImport("SmiSDK.dll", SetLastError=true)]
public static extern int SmiAccelerometerGetVector(out Vector vector);
答案 1 :(得分:0)
private void GetVectorHandler(Accelerometer.Vector accel)
{
if (Accelerometer.GetVector(ref accel) == SmiResultCode.Success)
{
yy = accel.y.ToString();
xx = accel.x.ToString();
zz = accel.z.ToString();
}
}
之后我们需要在form_load或wadeva中执行此操作
GetVectorHandler(gVector);
lblX.Text = "x: " + xx;
lblY.Text = "y: " + yy;
lblZ.Text = "z: " + zz;