第一个开发的项目,记录一下开发过程
一、去官网下载案例程序,在案例程序上做自己的功能
二、新建一个智能设备项目
三、调整窗口的大小,与PDA窗口大小一致
四、在之间下载的安装包内,找到DLL_4.430.zip,解压后,将dll文件引用到项目中,同时引用windowsce.forms
五、添加项目布局图及扫码按钮
六、将基恩士案例程序中的代码copy过来,主要是将初始化、窗口读取、触发、数据读取相关的复制过来。
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Bt.ScanLib;
using Bt;
namespace BT_W155GProject2
{
public partial class Form1 : Form
{
MsgWindow MsgWin; // 消息窗口
public static Form1 _MainForm1Instance; // 窗体
public String AppPath = ""; // 应用执行路径
//--------------------------------------------------------------
// DLLImport
//--------------------------------------------------------------
[DllImport("coredll.dll", EntryPoint = "DeleteObject")]
public static extern bool DeleteObject(IntPtr hObject);
public Form1()
{
InitializeComponent();
this.MsgWin = new MsgWindow(); // 生成消息窗口
}
private void Form1_Load(object sender, EventArgs e)
{
// 画面尺寸调整
if (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width == 240)
{
resolution.ScreenSize.VGAtoQVGA(this);
}
// 不显示窗体的最大化,最小化按钮
this.MaximizeBox = !this.MaximizeBox;
this.MinimizeBox = !this.MinimizeBox;
_MainForm1Instance = this;
// 取得执行路径
String path = this.GetType().Assembly.GetModules()[0].FullyQualifiedName;
Int32 en = path.LastIndexOf("\\");
AppPath = path.Substring(0, en);
}
/***********************************************************************