Exemplo n.º 1
0
        public void UpdateLabelBuffer(Graphics g, Font font, Brush labelBrush, Brush maskBrush, string labelFormat)
        {
            SizeF  sizef  = g.MeasureString(_contourValue.ToString(labelFormat), font);
            Bitmap bitmap = new Bitmap((int)Math.Ceiling(sizef.Width), (int)Math.Ceiling(sizef.Height), PixelFormat.Format32bppArgb);

            using (Graphics bg = Graphics.FromImage(bitmap))
            {
                bg.Clear(Color.Transparent);
                if (maskBrush != null)
                {
                    ContourLayer.DrawStringWithBorder(_contourValue.ToString(labelFormat), bg, new PointF(0, 0), font, labelBrush, maskBrush);
                }
                else
                {
                    bg.DrawString(_contourValue.ToString(labelFormat), font, labelBrush, new PointF(0, 0));
                }
            }
            _labelBuffer = bitmap;
        }
Exemplo n.º 2
0
        public IContourLayer FromXml(XElement element)
        {
            var proElements = element.Elements();

            if (proElements == null)
            {
                return(null);
            }
            IContourLayer lyr = new ContourLayer(PropertyConverter.AttToString(element, "layername"));

            foreach (XElement pElement in proElements)
            {
                if (ReadValueTypeProperty(pElement, lyr))
                {
                    continue;
                }
                ReadComplexProperty(pElement, lyr);
            }
            return(lyr);
        }