728x90
반응형
728x170
■ FlowDocumentReader 클래스를 사용하는 기본적인 방법을 보여준다.
▶ MainWindow.xaml
<Window x:Class="TestProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="800"
Height="600"
Title="TestProject"
FontFamily="나눔고딕코딩"
FontSize="16">
</Window>
▶ MainWindow.xaml.cs
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
Paragraph paragraph1 = new Paragraph();
paragraph1.Inlines.Add(new Bold(new Run("Some bold text in the paragraph.")));
paragraph1.Inlines.Add(new Run(" Some text that is not bold."));
Paragraph paragraph2 = new Paragraph(new Run("ListItem 1"));
Paragraph paragraph3 = new Paragraph(new Run("ListItem 2"));
Paragraph paragraph4 = new Paragraph(new Run("ListItem 3"));
List list = new List();
list.ListItems.Add(new ListItem(paragraph2));
list.ListItems.Add(new ListItem(paragraph3));
list.ListItems.Add(new ListItem(paragraph4));
FlowDocument flowDocument = new FlowDocument();
flowDocument.Blocks.Add(paragraph1);
flowDocument.Blocks.Add(list);
FlowDocumentReader flowDocumentReader = new FlowDocumentReader();
flowDocumentReader.Document = flowDocument;
Content = flowDocumentReader;
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] BlockUIContainer 엘리먼트 사용하기 (0) | 2022.12.05 |
---|---|
[C#/WPF] Section 클래스 사용하기 (0) | 2022.12.05 |
[C#/WPF] Section 엘리먼트 사용하기 (0) | 2022.12.05 |
[C#/WPF] Paragraph 클래스 사용하기 (0) | 2022.12.05 |
[C#/WPF] Paragraph 엘리먼트 사용하기 (0) | 2022.12.05 |
[C#/WPF] FlowDocumentReader 엘리먼트 사용하기 (0) | 2022.12.05 |
[C#/WPF] DynamicResource 태그 확장 : SystemParameters 클래스 정적 속성을 사용해 시스템 정보 설정하기 (0) | 2022.12.04 |
[C#/WPF] DynamicResource 태그 확장 : SystemFonts 클래스 정적 속성을 사용해 시스템 폰트 설정하기 (0) | 2022.12.04 |
[C#/WPF] ControlTemplate 엘리먼트 : Button 엘리먼트 정의하기 (0) | 2022.12.03 |
[C#/WPF] DataObject 클래스 : GetData 메소드를 사용해 특정 포맷 데이터 구하기 (0) | 2022.12.02 |
댓글을 달아 주세요