|
get { return dblLongitude; }
}
以上提到这些只是为可能会和我有同样需求的初学的网友提个醒,免得走弯路.
1. 附参考源代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.Samples.Location;
namespace TestGPS
{
public partial class Form1 : Form
{
//GPS设备状态对象
GpsDeviceState device = null;
//GPS位置对象
GpsPosition position = null;
//GPS对象
Gps gps = new Gps();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
gps.DeviceStateChanged += new DeviceStateChangedEventHandler(gps_DeviceStateChanged);
gps.LocationChanged += new LocationChangedEventHandler(gps_LocationChanged);
}
//位置改变时更新坐标数据
protected void gps_LocationChanged(object sender, LocationChangedEventArgs args)
{
position = args.Position;
}
//gps设备状态改变时更新设备的状态
void gps_DeviceStateChanged(object sender, DeviceStateChangedEventArgs args)
{
device = args.DeviceState;
}
//菜单:打开GPS设备
private void open_gps_Click(object sender, EventArgs e)
{
if (!gps.Opened)
{
gps.Open();
上一页 [1] [2] [3] [4] [5] [6] 下一页 |