예제 #1
0
        public void Textbox(Textbox tb, string t, Row row)
        {
            if (tb.DataElementOutput != DataElementOutputEnum.Output ||
                tb.DataElementName == null)
            {
                return;
            }

            if (rowstart != null)                       // In case no items in row are visible
            {                                           //   we delay until we get one.
//				WriteElement(rowstart);
                rowstart = null;
            }
            t = Xml.ToXmlAnsi(t);
            if (tb.DataElementStyle == DataElementStyleEnum.AttributeNormal)
            {                   // write out as attribute
                WriteAttribute(" {0}='{1}'",
                               tb.DataElementName, Xml.EscapeXmlAttribute(t));
            }
            else
            {                   // write out as element
                WriteElement("<{0}>{1}</{0}>", tb.DataElementName, t);
            }
        }
예제 #2
0
        private Color ReadXmlColor(XmlReader xr)
        {
            string sc = xr.ReadString();

            return(Xml.ColorFromHtml(sc, Color.Empty));
        }
예제 #3
0
        private void DrawMap(Report rpt, Graphics g, string mapfile, double max, double min)
        {
            Uri file = FileSystem.XmlFileExists(mapfile);

            MapData mp;

            if (file != null)
            {
                mp = MapData.Create(file.LocalPath);
            }
            else
            {
                rpt.rl.LogError(4, string.Format("Map Subtype file {0} not found.", mapfile));
                mp = new MapData();         // we'll at least put up something; but it won't be right
            }
            float scale = mp.GetScale(Layout.PlotArea.Width, Layout.PlotArea.Height);

            for (int iRow = 1; iRow <= CategoryCount; iRow++)
            {
                for (int iCol = 1; iCol <= SeriesCount; iCol++)
                {
                    string sv = GetSeriesValue(rpt, iCol);

                    string            c  = this.GetDataValueString(rpt, iRow, iCol);
                    List <MapPolygon> pl = mp.GetPolygon(sv);
                    if (pl == null)
                    {
                        continue;
                    }
                    Brush br = new SolidBrush(Xml.ColorFromHtml(c, Color.Transparent));
                    foreach (MapPolygon mpoly in pl)
                    {
                        PointF[] polygon  = mpoly.Polygon;
                        PointF[] drawpoly = new PointF[polygon.Length];
                        // make points relative to plotarea --- need to scale this as well
                        for (int ip = 0; ip < drawpoly.Length; ip++)
                        {
                            drawpoly[ip] = new PointF(Layout.PlotArea.X + (polygon[ip].X * scale), Layout.PlotArea.Y + (polygon[ip].Y * scale));
                        }
                        g.FillPolygon(br, drawpoly);
                        if (_showToolTips)
                        {
                            StringBuilder sb = new StringBuilder();
                            sb.Append("PolyToolTip:");
                            sb.Append(sv.Replace('|', '/'));        // we treat '|' as a separator character; don't allow in string
                            sb.Append(' ');
                            sb.Append(c.Replace('|', '/'));
                            foreach (PointF pf in drawpoly)
                            {
                                sb.AppendFormat(NumberFormatInfo.InvariantInfo, "|{0}|{1}", pf.X, pf.Y);
                            }
                            g.AddMetafileComment(new System.Text.ASCIIEncoding().GetBytes(sb.ToString()));
                        }
                    }
                    br.Dispose();
                }
            }
            // draw the outline of the map
            foreach (MapObject mo in mp.MapObjects)
            {
                mo.Draw(g, scale, Layout.PlotArea.X, Layout.PlotArea.Y);
            }
        }