示例#1
0
        private int NewShape(HCShapeStyle aStyle)
        {
            HCShape vShpae = null;

            switch (aStyle)
            {
            case HCShapeStyle.hssNone:
                break;

            case HCShapeStyle.hssLine:
                vShpae = new HCShapeLine();
                break;

            case HCShapeStyle.hssRectangle:
                vShpae = new HCShapeRectangle();
                break;

            case HCShapeStyle.hssEllipse:
                vShpae = new HCShapeEllipse();
                break;

            case HCShapeStyle.hssPolygon:
                vShpae = new HCShapePolygon();
                break;
            }

            if (vShpae != null)
            {
                vShpae.OnStructOver = DoShapeStructOver;
                this.Add(vShpae);
                return(this.Count - 1);
            }

            return(-1);
        }
示例#2
0
 public HCFloatLineItem(HCCustomData aOwnerData) : base(aOwnerData)
 {
     this.StyleNo = (byte)HCShapeStyle.hssLine;
     Width        = 100;
     Height       = 70;
     FShapeLine   = new HCShapeLine(new POINT(0, 0), new POINT(Width, Height));
 }
示例#3
0
        public void LoadFromStream(Stream aStream)
        {
            this.Clear();

            int vCount = 0;

            byte[] vBuffer = BitConverter.GetBytes(vCount);
            aStream.Read(vBuffer, 0, vBuffer.Length);
            vCount = BitConverter.ToInt32(vBuffer, 0);

            HCShape      vShape = null;
            HCShapeStyle vStyle = HCShapeStyle.hssNone;

            for (int i = 0; i < vCount; i++)
            {
                vStyle = (HCShapeStyle)aStream.ReadByte();

                switch (vStyle)
                {
                case HCShapeStyle.hssNone:
                    throw new Exception("HCShape读取失败,无效的样式值!");

                case HCShapeStyle.hssLine:
                    vShape = new HCShapeLine();
                    break;

                case HCShapeStyle.hssRectangle:
                    vShape = new HCShapeRectangle();
                    break;

                case HCShapeStyle.hssEllipse:
                    vShape = new HCShapeEllipse();
                    break;

                case HCShapeStyle.hssPolygon:
                    vShape = new HCShapePolygon();
                    break;
                }

                aStream.Position = aStream.Position - sizeof(byte);
                vShape.LoadFromStream(aStream);
                this.Add(vShape);
            }
        }
示例#4
0
        public void ParseXml(XmlElement aNode)
        {
            this.Clear();

            HCShape      vShape     = null;
            HCShapeStyle vStyle     = HCShapeStyle.hssNone;
            XmlElement   vShapeNode = null;

            for (int i = 0; i < aNode.ChildNodes.Count; i++)
            {
                vShapeNode = aNode.ChildNodes[i] as XmlElement;
                vStyle     = (HCShapeStyle)byte.Parse(vShapeNode.Attributes["style"].Value);

                switch (vStyle)
                {
                case HCShapeStyle.hssNone:
                    throw new Exception("HCShape读取失败,无效的样式值!");

                case HCShapeStyle.hssLine:
                    vShape = new HCShapeLine();
                    break;

                case HCShapeStyle.hssRectangle:
                    vShape = new HCShapeRectangle();
                    break;

                case HCShapeStyle.hssEllipse:
                    vShape = new HCShapeEllipse();
                    break;

                case HCShapeStyle.hssPolygon:
                    vShape = new HCShapePolygon();
                    break;
                }

                vShape.ParseXml(vShapeNode);
                this.Add(vShape);
            }
        }