The detail code of WINCE/Mobile system handheld pos

In order to meet customer’s use in different environment, CILICO put a new handheld terminal with fingerfrint, that is the CI350. For customer, the user do not need to care more about the operation mode, they just need to know the upter operation. That is okay. In order it is more convenient for people to study, we supply them the detailed code of wince and mobile system. They customer can easily work out the 1d barcode, 2d barcode, pictures, and so on.

In order for customer to study, we supply two kinds of code, they are C# and VC++. The following is,

  1. make a function, way and alt(the basic way for CI350)
  2. detail code
  3. the detail description
  4. the words setting
  5. Syntax:
      public bool SetGrayLevel(uint uLevel)
  6. parameter
  7. uLevel       【in】 degree(0-100) the deeper the color is, the bigger the value is, the slower the speed is.
  8. return value
  9. If successful, it is ture, and vice viser.
  10. the setting of Line spacing
  11. Syntax:
      public bool SetSpace(uint uSpace)

    2、parameter:

    uSpace           【in】 Line spacing, it is 0.

    3、return value:

    If successful, it is ture, and vice viser.

  12. Printing string
  13. Syntax:
      public bool WriteString(string str,uint uFontHeight)

    2、parameter:

    str             【in】Line spacing, it is 0.

    uFontHeight  【in】the hight of word(0-512)

    3、

    return value:

    If successful, it is ture, and vice viser.

  14. printing picture
  15. Syntax:
     public bool PrintImage(Image img)

    2、parameter:

    img   【in】Bitmap, note that the bitmap must be RGB16 bit, and the width is 384 pixels

    3、

    return value:

    If successful, it is ture, and vice viser.

  16. printTest codeusing System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    using Cilico;

     

    namespace PrintTest

    {

    public partial class Form1 : Form

    {

    Printer print = new Printer();

    public Form1()

    {

    InitializeComponent();

    //turn on the rquipment

    print.Open();

    textBox1.Text = “132132132\r\n456465\r\n789888\r\n”;

    byte bSpeed = 0;

    print.GetGrayLevel(out bSpeed);

    this.textBox2.Text = bSpeed.ToString();

    byte bSpace = 0;

    print.GetSpace(out bSpace);

    this.textBox3.Text = bSpace.ToString();

    }

    //Printing string

    private void button1_Click(object sender, EventArgs e)

    {

    uint u = (uint)Int16.Parse(textBox4.Text);

    if (print.IsOpen)

    {

    //Print the contents of the edit box, print the font height of 24 pixels
    Set within 12-512)

    if (!print.WriteString(textBox1.Text, u))

    {

    MessageBox.Show(“failure, the reason is ” + print.Error);

    }

    //Enter a newline to print out the data in memory

    if (!print.ReturnToNextLine())

    {

    MessageBox.Show(“failure, the reason is ” + print.Error);

    }

    }

    }

    //Print dynamic bitmap

    private void button2_Click(object sender, EventArgs e)

    {

    //Note that the width of the bitmap must be 384, PixelFormat must be a bit of 16

    Bitmap bmp = new Bitmap(384, 40, System.Drawing.Imaging.PixelFormat.Format16bppRgb565);

    Graphics g = Graphics.FromImage(bmp);

    g.Clear(Color.White);

    //circle

    g.DrawEllipse(new Pen(Color.Black), 10, 10, 20, 20);

    //Print bitmap

    if (print.IsOpen)

    {

    if (!print.PrintImage(bmp))

    {

    MessageBox.Show(print.Error);

    }

    }

    }

    //Note that the best picture is black and white two pixels, print only black and white, no gray adjustment

    //Note that the width of the bitmap must be 384, PixelFormat must be a bit of 16

    private void button4_Click(object sender, EventArgs e)

    {

    OpenFileDialog open = new OpenFileDialog();

    open.InitialDirectory = “”;

    open.Filter = “BMP|*.bmp|JPG|*.jpg|PNG|*.png|GIF|*.gif”;

    open.ShowDialog();

    if (open.FileName.Length <= 0)

    {

    return;

    }

    else

    {

    Bitmap bmp = new Bitmap(open.FileName);

    if (!print.PrintImage(bmp))

    {

    MessageBox.Show(print.Error);

    }

    }

    }

    //Set font gray

    private void button3_Click(object sender, EventArgs e)

    {

    uint u = (uint)Int16.Parse(textBox2.Text);

    if (print.IsOpen)

    {

    if (!print.SetGrayLevel(u))

    {

    MessageBox.Show(print.Error);

    }

    }

    }

    //Set font spacing

    private void button5_Click(object sender, EventArgs e)

    {

    uint u = (uint)Int16.Parse(textBox3.Text);

    if (print.IsOpen)

    {

    if (!print.SetSpace(u))

    {

    MessageBox.Show(print.Error);

    }

    }

    }

     

    private void button6_Click_1(object sender, EventArgs e)

    {

    if (print.IsOpen)

    {

    byte bSpeed = 0;

    print.GetGrayLevel(out bSpeed);

    this.textBox2.Text = bSpeed.ToString();

    }

    }

    }

    }