WPF中一點流檔案代碼,如下:
<Window x:Class="WpfApp3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp3"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<FlowDocumentScrollViewer Name="docViewer">
<FlowDocument Name="flowdocument" FontFamily="宋體" FontSize="12">
<Paragraph>西游記西游記西游記西游記西游記西游記西游記西游記西游記西游記西游記</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
<Button Content="添 加" Width="80" Height="32" Grid.Row="1" Click="Button_Click"/>
</Grid>
</Window>
private void Button_Click(object sender, RoutedEventArgs e)
{
PrintDialog CurrentPrintDialog = new PrintDialog();
CurrentPrintDialog.PrintDocument(((IDocumentPaginatorSource)flowdocument).DocumentPaginator, "aa");
}

就這么點流檔案,采用A4紙格式,列印出來,為什么就自動換行了呢?
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/254623.html
標籤:C#
下一篇:linq to xml怎么查找?
