Exemple #1
0
        public override void DoPrintJson(Newtonsoft.Json.Linq.JToken json, Spoon.Tools.TemplatePrint.Helper.PrintHelper.wPrintEventArgs e)
        {
            base.DoPrintJson(json, e);
            var txt = m_value;
            var jo  = json as Newtonsoft.Json.Linq.JObject;

            if (jo != null && jo.ContainsKey(Name))
            {
                txt = jo[Name].ToString();
            }
            var rect = Rectangle;

            rect.Offset(1, 1);
            rect.Width  -= 1;
            rect.Height -= 1;
            rect.Offset(e.Offset);
            var sf = new StringFormat();

            sf.Alignment     = m_alignHorizontal;
            sf.LineAlignment = m_alignVetical;
            e.Graphics.DrawString(txt, m_font, Brushes.Black, new RectangleF(rect.Location, rect.Size), sf);
        }
Exemple #2
0
        public override void DoPrintJson(Newtonsoft.Json.Linq.JToken json, Spoon.Tools.TemplatePrint.Helper.PrintHelper.wPrintEventArgs e)
        {
            base.DoPrintJson(json, e);
            var img = m_img;
            var jo  = json as Newtonsoft.Json.Linq.JObject;

            if (jo != null && jo.ContainsKey(Name))
            {
                var img2 = Image.FromFile(jo[Name].ToString());
                img = new Bitmap(img2);
                img2.Dispose();
            }
            var rect = Rectangle;

            rect.Offset(1, 1);
            rect.Width  -= 1;
            rect.Height -= 1;
            rect.Offset(e.Offset);
            if (img != null)
            {
                e.Graphics.DrawImage(img, rect);
            }
        }