Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();

            Chapter chapter = new Chapter();

            doc.Childs.Add(chapter);


            TextBlock mainBlock = new TextBlock();

            chapter.Childs.Add(mainBlock);

            ImageElement image = new ImageElement();

            MemoryStream mem = new MemoryStream();

            Properties.Resources.moto.Save(mem, System.Drawing.Imaging.ImageFormat.Png);

            image.SourceStream = mem;

            image.Width = 200;
            image.Height = 200;

            mainBlock.Childs.Add(image);


            TextBlock titleBlock = new TextBlock();

            titleBlock.Content = "Hello,World";

            titleBlock.VerticalContentAlignment = VerticalAlignment.Bottom;

            mainBlock.Childs.Add(titleBlock);

            LineBreak brk = new LineBreak();

            chapter.Childs.Add(brk);


            TextBlock breakedBlock = new TextBlock();

            breakedBlock.Content = "Sotto Hello,World";

            chapter.Childs.Add(breakedBlock);


            context = new DefaultPrintingContext(doc);

            printPreviewControl1.Document = context.PrintDocument;
 
        }
        public override void PrintChapter(Chapter chapter)
        {
            if (dontDrawNow)
                return;

            DrawBlock(chapter);
        }