本文整理汇总了C#中System.Windows.Documents.FixedPage类的典型用法代码示例。如果您正苦于以下问题:C# FixedPage类的具体用法?C# FixedPage怎么用?C# FixedPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FixedPage类属于System.Windows.Documents命名空间,在下文中一共展示了FixedPage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CreateFixedPage
/// <summary>
/// Creates a FixedPage from string.
/// </summary>
/// <param name="text">Text of page.</param>
/// <returns>FixedPage from text.</returns>
public static FixedPage CreateFixedPage(string text)
{
FixedPage page = new FixedPage();
TextBlock block = new TextBlock();
block.Inlines.Add(text);
page.Children.Add(block);
return page;
}
开发者ID:KFreon,项目名称:Useful-C-Sharp-Collection,代码行数:13,代码来源:Documents.cs
示例17: Visit
public override void Visit(ExportPage page){
fixedPage = FixedDocumentCreator.CreateFixedPage(page);
FixedPage = fixedPage;
foreach (var element in page.ExportedItems) {
AsAcceptor(element).Accept(this);
fixedPage.Children.Add(sectionCanvas);
}
}
开发者ID:lvv83,项目名称:SharpDevelop,代码行数:8,代码来源:WpfVisitor.cs
示例18: SetSize
public override void SetSize(FixedPage fixedPage)
{
var converter = new LengthConverter();
// ReSharper disable once PossibleNullReferenceException
fixedPage.Width = (double)converter.ConvertFromInvariantString("29.7cm");
// ReSharper disable once PossibleNullReferenceException
fixedPage.Height = (double)converter.ConvertFromInvariantString("21cm");
}
开发者ID:PeletonSoft,项目名称:Sketch,代码行数:9,代码来源:A4LandscapeFormatPageContent.cs
示例19: CreatePageInternal
void CreatePageInternal(FixedPage page, ExporterCollection items)
{
foreach (var element in items)
{
var item = ItemFactory(element);
if (item != null) {
FixedPage.SetLeft(item,element.StyleDecorator.Location.X );
FixedPage.SetTop(item,element.StyleDecorator.Location.Y);
page.Children.Add(item);
}
}
}
开发者ID:kristjan84,项目名称:SharpDevelop,代码行数:12,代码来源:FixedDocumentCreator.cs
示例20: PrintSimpleTextButton_Click
private void PrintSimpleTextButton_Click(object sender, RoutedEventArgs e)
{
// PrintDialog printDlg = new PrintDialog();
// // Create a FlowDocument dynamically.
// FlowDocument doc = CreateFlowDocument();
// doc.Name = "FlowDoc";
// // Create IDocumentPaginatorSource from FlowDocument
// IDocumentPaginatorSource idpSource = doc;
// // Call PrintDocument method to send document to printer
// printDlg.PrintDocument(idpSource.DocumentPaginator, "Hello WPF Printing.");
PrintDialog pd = new PrintDialog();
if (pd.ShowDialog() != true) return;
FixedDocument document = new FixedDocument();
document.DocumentPaginator.PageSize = new Size(8.5,11);
FixedPage page1 = new FixedPage();
page1.Width = document.DocumentPaginator.PageSize.Width;
page1.Height = document.DocumentPaginator.PageSize.Height;
Canvas can = new Canvas();
TextBlock page1Text = new TextBlock();
page1Text.Text = "This is the first page";
page1Text.FontSize = 10; // 30pt text
page1Text.Margin = new Thickness(5, 20, 30, 10);
can.Children.Add(page1Text);
// 1 inch margin
//page1.Children.Add(page1Text);
page1.Width = document.DocumentPaginator.PageSize.Width;
page1.Height = document.DocumentPaginator.PageSize.Height;
TextBlock page2Text = new TextBlock();
page2Text.Text = "This is the first page";
page2Text.FontSize = 40; // 30pt text
page2Text.Margin = new Thickness(5, 20, 30, 10); // 1 inch margin
can.Children.Add(page2Text);
page1.Children.Add(can);
PageContent page1Content = new PageContent();
((IAddChild)page1Content).AddChild(page1);
document.Pages.Add(page1Content);
//FixedPage page2 = new FixedPage();
//page2.Width = document.DocumentPaginator.PageSize.Width;
//page2.Height = document.DocumentPaginator.PageSize.Height;
//TextBlock page2Text = new TextBlock();
//page2Text.Text = "This is NOT the first page";
//page2Text.FontSize = 40;
//page2Text.Margin = new Thickness(96);
//page2.Children.Add(page2Text);
//PageContent page2Content = new PageContent();
//((IAddChild)page2Content).AddChild(page2);
//document.Pages.Add(page2Content);
pd.PrintDocument(document.DocumentPaginator, "My first document");
}
开发者ID:sumit10,项目名称:BMS,代码行数:52,代码来源:printtest.xaml.cs
注:本文中的System.Windows.Documents.FixedPage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论