コード例 #1
0
ファイル: Form1.cs プロジェクト: westybsa/MP.LSharp
        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;
 
        }
コード例 #2
0
        public override void PrintTextBlock(TextBlock textBlock)
        {
            if (dontDrawNow)
                return;

            DrawBlock(textBlock);
        }