三星api如何打电话

时间:2010-04-27 01:40:25

标签: c# windows-mobile accelerometer

有人知道我怎么称呼它? 公共结构SmiAccelerometerVector         {             公共浮动x;             公共浮动y;             公共浮动z;         }

我想获取x,y,z值并将其粘贴到标签中。

2 个答案:

答案 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)

谢谢ctacke我已经知道了。这是:)

    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;