当前位置: 首页>>代码示例>>C#>>正文


C# Documents.FixedPage类代码示例

本文整理汇总了C#中System.Windows.Documents.FixedPage的典型用法代码示例。如果您正苦于以下问题:C# FixedPage类的具体用法?C# FixedPage怎么用?C# FixedPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FixedPage类属于System.Windows.Documents命名空间,在下文中一共展示了FixedPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateFixedDocument

        public static FixedDocument CreateFixedDocument(double pageWidth, double pageHeight, UIElement content)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }

            if (pageWidth <= 0 || pageHeight <= 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            RenderTargetBitmap renderTarget = new RenderTargetBitmap(Convert.ToInt32(content.RenderSize.Width), Convert.ToInt32(content.RenderSize.Height),
                Constants.ScreenDPI, Constants.ScreenDPI, PixelFormats.Pbgra32);
            renderTarget.Render(content);

            FixedDocument doc = new FixedDocument();
            Size pageSize = new Size(pageWidth, pageHeight);
            doc.DocumentPaginator.PageSize = pageSize;
            FixedPage fixedPage = new FixedPage();
            fixedPage.Width = pageWidth;
            fixedPage.Height = pageHeight;
            Image image = new Image();
            image.Height = pageHeight;
            image.Width = pageWidth;
            image.Stretch = Stretch.Uniform;
            image.StretchDirection = StretchDirection.Both;
            image.Source = renderTarget;
            fixedPage.Children.Add(image);

            PageContent pageContent = new PageContent();
            ((IAddChild)pageContent).AddChild(fixedPage);
            doc.Pages.Add(pageContent);
            return doc;
        }
开发者ID:brunoklein99,项目名称:nikon-camera-control,代码行数:35,代码来源:DocumentUtility.cs

示例2: PageBuilder

        public PageBuilder(double width, double height, int marginsLeft, int marginsTop, int marginsRight, int marginsBottom, ContentControl frame)
        {
            _page = new PageContent();
              _fixedPage = new FixedPage {Background = Brushes.White, Width = width, Height = height};

              _repeater = new Repeater();
              var repeatContainer = new Grid {Margin = new Thickness(marginsLeft, marginsTop, marginsRight, marginsBottom)};
              repeatContainer.Children.Add(_repeater);

              frame.SetValue(FixedPage.LeftProperty, 0.00);
              frame.SetValue(FixedPage.TopProperty, 0.00);
              frame.SetValue(FrameworkElement.WidthProperty, _fixedPage.Width);
              frame.SetValue(FrameworkElement.HeightProperty, _fixedPage.Height);

              _fixedPage.Children.Add(frame);
              ((IAddChild)_page).AddChild(_fixedPage);

              frame.Content = repeatContainer;

              frame.Measure(new Size(width, height));
              frame.Arrange(new Rect(0, 0, width, height));

              _repeater.Width = repeatContainer.ActualWidth;
              _repeater.Height = repeatContainer.ActualHeight;
        }
开发者ID:frederiksen,项目名称:Task-Card-Creator,代码行数:25,代码来源:PageBuilder.cs

示例3: print_btn_Click

 private void print_btn_Click(object sender, RoutedEventArgs e)
 {
     try
      {
             report.report_cr_dr p = new BMS.report.report_cr_dr();
         p.lst_balance.ItemsSource = dr;
         p.r_date.Content = DateTime.Now.Date.ToShortDateString();
         p.r_name.Content = "Top Debitors";
         PrintDialog pd = new PrintDialog();
         FixedDocument document = new FixedDocument();
         document.DocumentPaginator.PageSize = new Size(96 * 8.5, 96 * 11);
         FixedPage page1 = new FixedPage();
         page1.Width = document.DocumentPaginator.PageSize.Width;
         page1.Height = document.DocumentPaginator.PageSize.Height;
         Canvas can = p.layout;
         page1.Children.Add(can);
         PageContent page1Content = new PageContent();
         ((IAddChild)page1Content).AddChild(page1);
         document.Pages.Add(page1Content);
         pd.PrintDocument(document.DocumentPaginator, "My first document");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sorry some system error has occour please try again");
     }
 }
开发者ID:sumit10,项目名称:BMS,代码行数:26,代码来源:home.xaml.cs

示例4: CreateFifthPageContent

    private FixedPage CreateFifthPageContent()
    {
      //PageContent pageContent = new PageContent();
      FixedPage fixedPage = new FixedPage();
      UIElement visual = BuildDrawing(); // CreateThirdVisual(false);

      FixedPage.SetLeft(visual, 0);
      FixedPage.SetTop(visual, 0);

      double pageWidth = 96 * 8.5;
      double pageHeight = 96 * 11;

      fixedPage.Width = pageWidth;
      fixedPage.Height = pageHeight;

      fixedPage.Children.Add((UIElement)visual);

      Size sz = new Size(8.5 * 96, 11 * 96);
      fixedPage.Measure(sz);
      fixedPage.Arrange(new Rect(new Point(), sz));
      fixedPage.UpdateLayout();

      //((IAddChild)pageContent).AddChild(fixedPage);
      return fixedPage;
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:25,代码来源:DrawingTest.xaml.cs

示例5: SaveXPS

        public static bool SaveXPS(FixedPage page, bool isSaved)
        {
            FixedDocument fixedDoc = new FixedDocument();//创建一个文档
            fixedDoc.DocumentPaginator.PageSize = new Size(96 * 8.5, 96 * 11);

            PageContent pageContent = new PageContent();
            ((IAddChild)pageContent).AddChild(page);
            fixedDoc.Pages.Add(pageContent);//将对象加入到当前文档中

            string containerName = GetXPSFromDialog(isSaved);
            if (containerName != null)
            {
                try
                {
                    File.Delete(containerName);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }

                XpsDocument _xpsDocument = new XpsDocument(containerName, FileAccess.Write);

                XpsDocumentWriter xpsdw = XpsDocument.CreateXpsDocumentWriter(_xpsDocument);
                xpsdw.Write(fixedDoc);//写入XPS文件
                _xpsDocument.Close();
                return true;
            }
            else return false;
        }
开发者ID:mydipcom,项目名称:MEIKReport,代码行数:30,代码来源:FileHelper.cs

示例6: UserControl_Loaded

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            var dialog = new PrintDialog();
            document.DocumentPaginator.PageSize = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight);
            fixedPage = new FixedPage
            {
                Height = document.DocumentPaginator.PageSize.Height,
                Width = document.DocumentPaginator.PageSize.Width
            };
            grid = new Grid();
            grid.Arrange(new Rect(0, 0, fixedPage.Width, fixedPage.Height));
            fixedPage.Children.Add(grid);
            pageContent = new PageContent { Child = fixedPage };
            pageContent.Arrange(new Rect(0, 0, fixedPage.Width, fixedPage.Height));
            fixedPage.Margin = new Thickness(20, 44, 20, 44);

            for (int i = 0; i < totalRows; i++)
            {
                grid.RowDefinitions.Add(new RowDefinition());
            }
            for (int j = 0; j < totalColumns; j++)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition());
            }

            document.Pages.Add(pageContent);
        }
开发者ID:sergiosorias,项目名称:terminalzero,代码行数:27,代码来源:BarcodePrintView.xaml.cs

示例7: FixedDocumentFromImageStream

        public static FixedDocument FixedDocumentFromImageStream(Stream[] ImagesStream)
        {
            FixedDocument fdReturn = new FixedDocument();

            foreach (Stream streamImage in ImagesStream)
            {
                FixedPage fpFromImage = new FixedPage();

                var bitImage = new BitmapImage();
                bitImage.BeginInit();
                bitImage.StreamSource = streamImage;
                bitImage.DecodePixelWidth = 250;
                bitImage.CacheOption = BitmapCacheOption.OnLoad;
                bitImage.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
                bitImage.EndInit();
                bitImage.StreamSource.Seek(0, System.IO.SeekOrigin.Begin);
                bitImage.Freeze();

                var tempImage = new System.Windows.Controls.Image { Source = bitImage };
                //var imageObject = new ImageObject(tempImage, fileName);

                fpFromImage.Children.Add(tempImage);
                fdReturn.Pages.Add(new PageContent() { Child = fpFromImage });

                bitImage.StreamSource.Dispose();
            }

            return fdReturn;
        }
开发者ID:cipjota,项目名称:Chronos,代码行数:29,代码来源:XpsHelper.cs

示例8: AddPage

 public void AddPage(int docIndex, FixedPage page)
 {
     var rollUpFixedDocument = _documents[docIndex];
     TestForExistingPages(rollUpFixedDocument);
     rollUpFixedDocument.Pages.Add(new RollUpFixedPage(page));
     _fixedDocumentSequence = null;
 }
开发者ID:ClemensT,项目名称:WPF-Samples,代码行数:7,代码来源:RollupDocument.cs

示例9: btnPrint_Click_1

        private void btnPrint_Click_1(object sender, RoutedEventArgs e)
        {
            var printControl = new SummaryControl();
            printControl.DataContext = _reservation;
            printControl.Width = 8.27 * 96;
            printControl.Height = 11.69 * 96;

            //Create a fixed Document and Print the document
            FixedDocument fixedDoc = new FixedDocument();
            PageContent pageContent = new PageContent();
            FixedPage fixedPage = new FixedPage();
            fixedPage.Height = 11.69 * 96;
            fixedPage.Width = 8.27 * 96;

            fixedPage.Children.Add(printControl);
            ((System.Windows.Markup.IAddChild)pageContent).AddChild(fixedPage);
            fixedDoc.Pages.Add(pageContent);

            PrintDialog dialog = new PrintDialog();
            if (dialog.ShowDialog() == true)
            {
                //dialog.PrintVisual(_PrintCanvas, "My Canvas");
                dialog.PrintDocument(fixedDoc.DocumentPaginator, "Print label");
            }
        }
开发者ID:jaggavarapu,项目名称:AirlineReservation,代码行数:25,代码来源:OrderSummaryPage.xaml.cs

示例10: btnXpsDocumentWriter_Click

        private void btnXpsDocumentWriter_Click(object sender, RoutedEventArgs e)
        {
            using (Package xpsPackage = Package.Open("Out.xps", FileMode.Create,
                           FileAccess.ReadWrite))
            using (XpsDocument doc = new XpsDocument(xpsPackage))
            {

                FixedPage page = new FixedPage();
                Canvas canvas = new Canvas();
                canvas.Width = 600;
                canvas.Height = 400;
                page.Children.Add(canvas);
                Rectangle rect = new Rectangle();
                Canvas.SetLeft(rect, 50);
                Canvas.SetTop(rect, 50);
                rect.Width = 200;
                rect.Height = 100;
                rect.Stroke = Brushes.Black;
                rect.StrokeThickness = 1;
                canvas.Children.Add(rect);
                XpsDocumentWriter documentWriter =
                XpsDocument.CreateXpsDocumentWriter(doc);
                documentWriter.Write(page);

                doc.CoreDocumentProperties.Description = "Rectangle Output";
            }
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:27,代码来源:Window3.xaml.cs

示例11: CreateFixedPage

		public static FixedPage CreateFixedPage(ExportPage exportPage) {
			var fixedPage = new FixedPage();
			fixedPage.Width = exportPage.Size.ToWpf().Width;
			fixedPage.Height = exportPage.Size.ToWpf().Height;
			fixedPage.Background = new SolidColorBrush(System.Drawing.Color.White.ToWpf());
			return fixedPage;
		}
开发者ID:hefnerliu,项目名称:SharpDevelop,代码行数:7,代码来源:FixedDocumentCreator.cs

示例12: CreateFixedSOMElement

        //--------------------------------------------------------------------
        //
        // Public Properties
        //
        //---------------------------------------------------------------------

        #region Static methods

        public static FixedSOMElement CreateFixedSOMElement(FixedPage page, UIElement uiElement, FixedNode fixedNode, int startIndex, int endIndex)
        {
            FixedSOMElement element = null;
            if (uiElement is Glyphs)
            {
                Glyphs glyphs = uiElement as Glyphs;
                if (glyphs.UnicodeString.Length > 0)
                {
                    GlyphRun glyphRun = glyphs.ToGlyphRun();
                    Rect alignmentBox = glyphRun.ComputeAlignmentBox();
                    alignmentBox.Offset(glyphs.OriginX, glyphs.OriginY);
                    GeneralTransform transform = glyphs.TransformToAncestor(page);
                    
                    if (startIndex < 0)
                    {
                        startIndex = 0;
                    }
                    if (endIndex < 0)
                    {
                        endIndex = glyphRun.Characters == null ? 0 : glyphRun.Characters.Count;
                    }
                    element = FixedSOMTextRun.Create(alignmentBox, transform, glyphs, fixedNode, startIndex, endIndex, false);
                }
            }
            else if (uiElement is Image)
            {
                element = FixedSOMImage.Create(page, uiElement as Image, fixedNode);
            }
            else if (uiElement is Path)
            {
                element = FixedSOMImage.Create(page, uiElement as Path, fixedNode);
            }
            return element;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:42,代码来源:FixedSOMElement.cs

示例13: AddPageToDocument

        static void AddPageToDocument(FixedDocument fixedDocument,FixedPage page)
        {
            PageContent pageContent = new PageContent();
            ((IAddChild)pageContent).AddChild(page);

            fixedDocument.Pages.Add(pageContent);
        }
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:7,代码来源:WpfExporter.cs

示例14: CreatePawnTicketContent

        private PageContent CreatePawnTicketContent()
        {
            PageContent pageContent = new PageContent();
            FixedPage fixedPage = new FixedPage();
            UIElement visual = PawnTicketUIElement();

            FixedPage.SetLeft(visual, 0);
            FixedPage.SetTop(visual, 0);

            double pageWidth = 96 * 8.5;
            double pageHeight = 96 * 11;

            fixedPage.Width = pageWidth;
            fixedPage.Height = pageHeight;

            fixedPage.Children.Add((UIElement)visual);

            Size sz = new Size(8.5 * 96, 11 * 96);
            fixedPage.Measure(sz);
            fixedPage.Arrange(new Rect(new Point(), sz));
            fixedPage.UpdateLayout();

            ((IAddChild)pageContent).AddChild(fixedPage);
            return pageContent;
        }
开发者ID:RayMetz100,项目名称:hyperpawn,代码行数:25,代码来源:PawnTicketTry1.cs

示例15: printing_2

        public void printing_2(Grid grid_table_print)
        {
            DocumentViewer documentViewer1 = new DocumentViewer();
            FixedDocument fixedDoc = new FixedDocument();
            PageContent pgc = new PageContent();
            FixedPage fxp = new FixedPage();
            //A4
            fxp.Width = 11.69 * 96;
            fxp.Height = 8.27 * 96;

            StackPanel panel = new StackPanel();
            panel.Orientation = Orientation.Vertical;
            panel.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            panel.Width = (11.69 * 96) * 0.9;
            panel.Orientation = Orientation.Vertical;
            Thickness margin = panel.Margin;
            margin.Bottom = 0;
            margin.Left = 50;
            margin.Top = 50;
            margin.Right = 25;
            panel.Margin = margin;
            BitmapImage bmp_ = new BitmapImage();
            Label test_lb = new Label();
            test_lb.Content = "\n\n\t\t\tРежим расчетов \n \tОцифровка в автоматическом режиме";
            margin = test_lb.Margin;
            margin.Bottom = 50;
            margin.Left = 50;
            margin.Top = 50;
            margin.Right = 0;
            test_lb.BorderThickness = margin;

            panel.Children.Add(test_lb);

            ImageSource imageSource = new BitmapImage(new Uri(Directory.GetCurrentDirectory() + "\\file.jpg"));

            Image img = new Image();
            img.Source = imageSource;
            panel.Children.Add(img);

            Grid grid_table_print_copy = new Grid();// { DataContext = grid_table_print.DataContext };
            string gridXaml = XamlWriter.Save(grid_table_print);
            StringReader stringReader = new StringReader(gridXaml);
            XmlReader xmlReader = XmlReader.Create(stringReader);
            grid_table_print_copy = (Grid)XamlReader.Load(xmlReader);

            panel.Children.Add(grid_table_print_copy);

            fxp.Children.Add(panel);

            ((System.Windows.Markup.IAddChild)pgc).AddChild(fxp);
            fixedDoc.Pages.Add(pgc);

            documentViewer1.Document = fixedDoc;
            Window ShowWindow = new Window();
            ShowWindow.Width = 850;
            ShowWindow.Height = 850;
            ShowWindow.Content = documentViewer1;
            ShowWindow.Show();
        }
开发者ID:K0lyuchiy,项目名称:Tass,代码行数:59,代码来源:print.cs


注:本文中的System.Windows.Documents.FixedPage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。