Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public HCShape()
 {
     FStyle       = HCShapeStyle.hssNone;
     FStructState = HCStructState.hstcStop;
     FVersion     = 0;
     FColor       = Color.Black;
     Cursor       = Cursors.Default;
 }
Exemplo n.º 3
0
 public void DisActive()
 {
     FOperStyle = HCShapeStyle.hssNone;
     if (FActiveIndex >= 0)
     {
         this[FActiveIndex].Active = false;
     }
 }
Exemplo n.º 4
0
 private void SetOperStyle(HCShapeStyle value)
 {
     if (FOperStyle != value)
     {
         ActiveIndex = -1;
         FOperStyle  = value;
     }
 }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
0
 public virtual void Assign(HCShape source)
 {
     FStyle   = source.Style;
     FVersion = source.Version;
     FColor   = source.Color;
 }
Exemplo n.º 8
0
 public virtual void ParseXml(XmlElement aNode)
 {
     FStyle   = (HCShapeStyle)byte.Parse(aNode.Attributes["style"].Value);
     FVersion = byte.Parse(aNode.Attributes["ver"].Value);
     FColor   = HC.GetXmlRGBColor(aNode.Attributes["color"].Value);
 }
Exemplo n.º 9
0
 public virtual void LoadFromStream(Stream aStream)
 {
     FStyle   = (HCShapeStyle)aStream.ReadByte();
     FVersion = (byte)aStream.ReadByte();
     HC.HCLoadColorFromStream(aStream, ref FColor);
 }
Exemplo n.º 10
0
 public HCShapeManager() : base()
 {
     FActiveIndex = -1;
     FHotIndex    = -1;
     FOperStyle   = HCShapeStyle.hssNone;
 }