⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stroke.cs

📁 采用vc#.net和sqlce实现智能手机端和服务器数据交换
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;

namespace Microsoft.Sql.SqlCe.Samples.Cs.IBuySpyDelivery.IBuySpyDevice
{
	internal class Stroke
	{
        ArrayList pointList;

        public Stroke(int capacity)
		{
            pointList = new ArrayList(capacity);
		}

        public Point this[int index] {
            get {
                return (Point) pointList[index];
            }

            set {
                pointList[index] = value;
            }
        }

        public void Add(Point point) {
            pointList.Add(point);
        }

        public int Count {
            get {
                return pointList.Count;
            }
        }

        /// Stream representation. Format: [X][Y][X][Y]...[X][Y][0xFFFF][0xFFFF]
        ///
        public short[] ToShortArray() {
            short[] buf = new short[2 * pointList.Count + 2];
            for (int i=0; i<pointList.Count; i++) {
                buf[2*i] = (short) ((Point)pointList[i]).X;
                buf[2*i + 1] = (short) ((Point)pointList[i]).Y; 
            }

            buf[buf.Length - 2] = unchecked ((short) 0xFFFF);
            buf[buf.Length - 1] = unchecked ((short) 0xFFFF);
            return buf;
        }

         public Point[] ToPointArray() {
            Point[] buf = new Point[pointList.Count];
            for (int i=0; i<buf.Length; i++) {
                buf[i] = (Point) pointList[i];
            }
            return buf;
        }

         public void Fill(short[] buf, int startIndx, int endIndx) {
            short x,y;
            if (null == buf || startIndx < 0 || endIndx <=0) return;
 
            this.pointList.Clear();
            for (int i=startIndx; i<endIndx; i += 2) {
                x = buf[i];
                y = buf[i+1];
                this.pointList.Add(new Point(x, y));
            }
        }
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -