Пример #1
0
        protected virtual void UnternodesZeichnen(
            XMLPaintArten paintArt,
            int offSetX,
            int offSetY,
            PaintEventArgs e)
        {
            if (this._xmlNode is XmlText)
            {
                return;
            }
            if (this._xmlNode == null)
            {
                throw new ApplicationException("UnternodesZeichnen:XMLNode ist leer");
            }
            this._paintPos.PosX += this._xmlEditor.Regelwerk.AbstandFliessElementeX;
            switch (this._xmlEditor.Regelwerk.DarstellungsArt(this._xmlNode))
            {
            case DarstellungsArten.EigeneZeile:
                this._paintPos.ZeilenStartX = this._paintPos.PosX;
                break;
            }
            for (int index = 0; index < this._xmlNode.ChildNodes.Count; ++index)
            {
                XMLElement element;
                if (index >= this._childElemente.Count)
                {
                    element = this._xmlEditor.createElement(this._xmlNode.ChildNodes[index]);
                    this._childElemente.Add((object)element);
                }
                else
                {
                    element = (XMLElement)this._childElemente[index];
                    if (element == null)
                    {
                        throw new ApplicationException(string.Format("UnternodesZeichnen:childElement ist leer: PaintArt:{0} outerxml:{1} >> innerxml {2}", (object)paintArt, (object)this._xmlNode.OuterXml, (object)this._xmlNode.InnerXml));
                    }
                    if (element.XMLNode != this._xmlNode.ChildNodes[index] && paintArt == XMLPaintArten.Vorberechnen)
                    {
                        element.Dispose();
                        element = this._xmlEditor.createElement(this._xmlNode.ChildNodes[index]);
                        this._childElemente[index] = (object)element;
                    }
                }
                switch (this._xmlEditor.Regelwerk.DarstellungsArt(element.XMLNode))
                {
                case DarstellungsArten.Fliesselement:
                    if (this._paintPos.PosX > this._paintPos.ZeilenEndeX)
                    {
                        this._paintPos.PosY         += this._paintPos.HoeheAktZeile + this._xmlEditor.Regelwerk.AbstandYZwischenZeilen;
                        this._paintPos.HoeheAktZeile = 0;
                        this._paintPos.PosX          = this._paintPos.ZeilenStartX;
                    }
                    XMLEditorPaintPos xmlEditorPaintPos1 = new XMLEditorPaintPos()
                    {
                        ZeilenStartX  = this._paintPos.ZeilenStartX,
                        ZeilenEndeX   = this._paintPos.ZeilenEndeX,
                        PosX          = this._paintPos.PosX,
                        PosY          = this._paintPos.PosY,
                        HoeheAktZeile = this._paintPos.HoeheAktZeile
                    };
                    element.PaintPos = xmlEditorPaintPos1;
                    element.Paint(paintArt, offSetX, offSetY, e);
                    break;

                case DarstellungsArten.EigeneZeile:
                    this._paintPos.PosY         += this._xmlEditor.Regelwerk.AbstandYZwischenZeilen + this._paintPos.HoeheAktZeile;
                    this._paintPos.HoeheAktZeile = 0;
                    this._paintPos.PosX          = this._startX + this._xmlEditor.Regelwerk.ChildEinrueckungX;
                    XMLEditorPaintPos xmlEditorPaintPos2 = new XMLEditorPaintPos()
                    {
                        ZeilenStartX  = this._paintPos.ZeilenStartX,
                        ZeilenEndeX   = this._paintPos.ZeilenEndeX,
                        PosX          = this._paintPos.PosX,
                        PosY          = this._paintPos.PosY,
                        HoeheAktZeile = this._paintPos.HoeheAktZeile
                    };
                    if ((uint)paintArt > 0U)
                    {
                        using (Pen pen1 = new Pen(Color.Gray, 1f))
                        {
                            pen1.DashStyle = DashStyle.Dash;
                            pen1.StartCap  = LineCap.SquareAnchor;
                            pen1.EndCap    = LineCap.NoAnchor;
                            Graphics graphics1 = e.Graphics;
                            Pen      pen2      = pen1;
                            Point    ankerPos  = this.AnkerPos;
                            int      x1        = ankerPos.X;
                            ankerPos = this.AnkerPos;
                            int y1 = ankerPos.Y;
                            ankerPos = this.AnkerPos;
                            int x2 = ankerPos.X;
                            ankerPos = element.AnkerPos;
                            int y2 = ankerPos.Y;
                            graphics1.DrawLine(pen2, x1, y1, x2, y2);
                            pen1.StartCap = LineCap.NoAnchor;
                            pen1.EndCap   = LineCap.SquareAnchor;
                            Graphics graphics2 = e.Graphics;
                            Pen      pen3      = pen1;
                            ankerPos = this.AnkerPos;
                            int x3 = ankerPos.X;
                            ankerPos = element.AnkerPos;
                            int y3 = ankerPos.Y;
                            ankerPos = element.AnkerPos;
                            int x4 = ankerPos.X;
                            ankerPos = element.AnkerPos;
                            int y4 = ankerPos.Y;
                            graphics2.DrawLine(pen3, x3, y3, x4, y4);
                        }
                    }
                    element.PaintPos = xmlEditorPaintPos2;
                    element.Paint(paintArt, offSetX, offSetY, e);
                    break;

                default:
                    int num = (int)MessageBox.Show("undefiniert");
                    break;
                }
                this._paintPos.PosX          = element.PaintPos.PosX;
                this._paintPos.PosY          = element.PaintPos.PosY;
                this._paintPos.HoeheAktZeile = element.PaintPos.HoeheAktZeile;
                this._paintPos.BisherMaxX    = Math.Max(this._paintPos.BisherMaxX, element.PaintPos.BisherMaxX);
            }
            while (this._xmlNode.ChildNodes.Count < this._childElemente.Count)
            {
                XMLElement xmlElement = (XMLElement)this._childElemente[this._childElemente.Count - 1];
                this._childElemente.Remove(this._childElemente[this._childElemente.Count - 1]);
                xmlElement.Dispose();
                this._childElemente.TrimToSize();
            }
        }
Пример #2
0
        protected virtual void UnternodesZeichnen(XMLPaintArten paintArt, int offSetX, int offSetY, PaintEventArgs e)
        {
            if (!(this._xmlNode is XmlText))
            {
                if (this._xmlNode == null)
                {
                    throw new ApplicationException("UnternodesZeichnen:XMLNode ist leer");
                }
                this._paintPos.PosX += this._xmlEditor.Regelwerk.AbstandFliessElementeX;
                switch (this._xmlEditor.Regelwerk.DarstellungsArt(this._xmlNode))
                {
                case DarstellungsArten.EigeneZeile:
                    this._paintPos.ZeilenStartX = this._paintPos.PosX;
                    break;
                }
                for (int i = 0; i < this._xmlNode.ChildNodes.Count; i++)
                {
                    XMLElement xMLElement;
                    if (i >= this._childElemente.Count)
                    {
                        xMLElement = this._xmlEditor.createElement(this._xmlNode.ChildNodes[i]);
                        this._childElemente.Add(xMLElement);
                    }
                    else
                    {
                        xMLElement = (XMLElement)this._childElemente[i];
                        if (xMLElement == null)
                        {
                            throw new ApplicationException(string.Format("UnternodesZeichnen:childElement ist leer: PaintArt:{0} outerxml:{1} >> innerxml {2}", paintArt, this._xmlNode.OuterXml, this._xmlNode.InnerXml));
                        }
                        if (xMLElement.XMLNode != this._xmlNode.ChildNodes[i] && paintArt == XMLPaintArten.Vorberechnen)
                        {
                            xMLElement.Dispose();
                            xMLElement             = this._xmlEditor.createElement(this._xmlNode.ChildNodes[i]);
                            this._childElemente[i] = xMLElement;
                        }
                    }
                    switch (this._xmlEditor.Regelwerk.DarstellungsArt(xMLElement.XMLNode))
                    {
                    case DarstellungsArten.Fliesselement:
                    {
                        if (this._paintPos.PosX > this._paintPos.ZeilenEndeX)
                        {
                            this._paintPos.PosY         += this._paintPos.HoeheAktZeile + this._xmlEditor.Regelwerk.AbstandYZwischenZeilen;
                            this._paintPos.HoeheAktZeile = 0;
                            this._paintPos.PosX          = this._paintPos.ZeilenStartX;
                        }
                        XMLEditorPaintPos obj = new XMLEditorPaintPos
                        {
                            ZeilenStartX  = this._paintPos.ZeilenStartX,
                            ZeilenEndeX   = this._paintPos.ZeilenEndeX,
                            PosX          = this._paintPos.PosX,
                            PosY          = this._paintPos.PosY,
                            HoeheAktZeile = this._paintPos.HoeheAktZeile
                        };
                        XMLEditorPaintPos paintPos = xMLElement.PaintPos = obj;
                        xMLElement.Paint(paintArt, offSetX, offSetY, e);
                        break;
                    }

                    case DarstellungsArten.EigeneZeile:
                    {
                        this._paintPos.PosY         += this._xmlEditor.Regelwerk.AbstandYZwischenZeilen + this._paintPos.HoeheAktZeile;
                        this._paintPos.HoeheAktZeile = 0;
                        this._paintPos.PosX          = this._startX + this._xmlEditor.Regelwerk.ChildEinrueckungX;
                        XMLEditorPaintPos paintPos = new XMLEditorPaintPos
                        {
                            ZeilenStartX  = this._paintPos.ZeilenStartX,
                            ZeilenEndeX   = this._paintPos.ZeilenEndeX,
                            PosX          = this._paintPos.PosX,
                            PosY          = this._paintPos.PosY,
                            HoeheAktZeile = this._paintPos.HoeheAktZeile
                        };
                        if (paintArt != 0)
                        {
                            using (Pen pen = new Pen(Color.Gray, 1f))
                            {
                                pen.DashStyle = DashStyle.Dash;
                                pen.StartCap  = LineCap.SquareAnchor;
                                pen.EndCap    = LineCap.NoAnchor;
                                Graphics graphics = e.Graphics;
                                Pen      pen2     = pen;
                                Point    ankerPos = this.AnkerPos;
                                int      x        = ankerPos.X;
                                ankerPos = this.AnkerPos;
                                int y = ankerPos.Y;
                                ankerPos = this.AnkerPos;
                                int x2 = ankerPos.X;
                                ankerPos = xMLElement.AnkerPos;
                                graphics.DrawLine(pen2, x, y, x2, ankerPos.Y);
                                pen.StartCap = LineCap.NoAnchor;
                                pen.EndCap   = LineCap.SquareAnchor;
                                Graphics graphics2 = e.Graphics;
                                Pen      pen3      = pen;
                                ankerPos = this.AnkerPos;
                                int x3 = ankerPos.X;
                                ankerPos = xMLElement.AnkerPos;
                                int y2 = ankerPos.Y;
                                ankerPos = xMLElement.AnkerPos;
                                int x4 = ankerPos.X;
                                ankerPos = xMLElement.AnkerPos;
                                graphics2.DrawLine(pen3, x3, y2, x4, ankerPos.Y);
                            }
                        }
                        xMLElement.PaintPos = paintPos;
                        xMLElement.Paint(paintArt, offSetX, offSetY, e);
                        break;
                    }

                    default:
                        MessageBox.Show("undefiniert");
                        break;
                    }
                    this._paintPos.PosX          = xMLElement.PaintPos.PosX;
                    this._paintPos.PosY          = xMLElement.PaintPos.PosY;
                    this._paintPos.HoeheAktZeile = xMLElement.PaintPos.HoeheAktZeile;
                    this._paintPos.BisherMaxX    = Math.Max(this._paintPos.BisherMaxX, xMLElement.PaintPos.BisherMaxX);
                }
                while (this._xmlNode.ChildNodes.Count < this._childElemente.Count)
                {
                    XMLElement xMLElement = (XMLElement)this._childElemente[this._childElemente.Count - 1];
                    this._childElemente.Remove(this._childElemente[this._childElemente.Count - 1]);
                    xMLElement.Dispose();
                    this._childElemente.TrimToSize();
                }
            }
        }