質問するログイン新規登録

回答編集履歴

2

permalink

2024/08/31 21:42

投稿

TN8001
TN8001

スコア10169

answer CHANGED
@@ -24,7 +24,7 @@
24
24
  .NET 6が使える場合は、自由に変えられるようになったようです。
25
25
  [Use theme to create DocumentGridPage borders by wjk · Pull Request #2574 · dotnet/wpf](https://github.com/dotnet/wpf/pull/2574)
26
26
 
27
- [wpf/DocumentViewer.xaml#L1207 at main · dotnet/wpf](https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Themes/XAML/DocumentViewer.xaml#L1207)
27
+ [wpf/DocumentViewer.xaml#L1207 at main · dotnet/wpf](https://github.com/dotnet/wpf/blob/f351cdaf0fd15789d3b5f523a3cc38896f5ae59f/src/Microsoft.DotNet.Wpf/src/Themes/XAML/DocumentViewer.xaml#L1207)
28
28
 
29
29
  ```xml
30
30
  <Window

1

見直しキャンペーン中

2023/07/29 07:41

投稿

TN8001
TN8001

スコア10169

answer CHANGED
@@ -1,115 +1,115 @@
1
- > これらの表示のされ方をカスタマイズすることは、DocumentViewerで可能でしょうか。
2
-
3
- > 各ページの周りのボーダーライン(太さ、色など)
4
- > 各ページの影(色、大きさ、透明度など)
5
-
6
- 消すだけなら`ShowPageBorders`があります。
7
- [DocumentViewer.ShowPageBorders プロパティ (System.Windows.Controls) | Microsoft Docs](https://docs.microsoft.com/ja-jp/dotnet/api/system.windows.controls.documentviewer.showpageborders?view=netcore-3.1)
8
-
9
- > 縦並びの場合の、ページ間の距離
10
-
11
- [DocumentViewer.VerticalPageSpacing プロパティ (System.Windows.Controls) | Microsoft Docs](https://docs.microsoft.com/ja-jp/dotnet/api/system.windows.controls.documentviewer.verticalpagespacing?view=netcore-3.1#System_Windows_Controls_DocumentViewer_VerticalPageSpacing)
12
-
13
- > ページの表示方法(StackPanel のように単に並べたり、WrapPanel のように自動整列したり)
14
- > を変更したいです。
15
-
16
- これはさすがに無理じゃないですかね?(わかんないですけど)
17
- `DocumentViewer`の改造というか、`DocumentViewer`のようなものを作ることになるんじゃないでしょうか。
18
-
19
- ---
20
-
21
- > 各ページの周りのボーダーライン(太さ、色など)
22
- > 各ページの影(色、大きさ、透明度など)
23
-
24
- .NET 6が使える場合は、自由に変えられるようになったようです。
25
- [Use theme to create DocumentGridPage borders by wjk · Pull Request #2574 · dotnet/wpf](https://github.com/dotnet/wpf/pull/2574)
26
-
27
- [wpf/DocumentViewer.xaml#L1207 at main · dotnet/wpf](https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Themes/XAML/DocumentViewer.xaml#L1207)
28
-
29
- ```xaml
30
- <Window
31
- x:Class="Questions366470.MainWindow"
32
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
34
- Width="800"
35
- Height="450">
36
- <Window.Resources>
37
- <Style
38
- x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement},
39
- ResourceId=DocumentGridPageContainerWithBorder}"
40
- BasedOn="{x:Null}"
41
- TargetType="ContentControl">
42
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
43
- <Setter Property="Template">
44
- <Setter.Value>
45
- <ControlTemplate TargetType="{x:Type ContentControl}">
46
- <Grid>
47
- <Grid.RowDefinitions>
48
- <RowDefinition Height="5" />
49
- <RowDefinition Height="*" />
50
- <RowDefinition Height="5" />
51
- </Grid.RowDefinitions>
52
- <Grid.ColumnDefinitions>
53
- <ColumnDefinition Width="5" />
54
- <ColumnDefinition Width="*" />
55
- <ColumnDefinition Width="5" />
56
- </Grid.ColumnDefinitions>
57
-
58
- <Border
59
- Grid.RowSpan="2"
60
- Grid.ColumnSpan="2"
61
- Background="LightGray"
62
- BorderBrush="Red"
63
- BorderThickness="5">
64
- <ContentPresenter />
65
- </Border>
66
-
67
- <Rectangle
68
- Grid.Row="1"
69
- Grid.Column="2"
70
- Fill="Blue"
71
- Opacity="0.35" />
72
- <Rectangle
73
- Grid.Row="2"
74
- Grid.Column="1"
75
- Grid.ColumnSpan="2"
76
- Fill="Blue"
77
- Opacity="0.35" />
78
- </Grid>
79
- </ControlTemplate>
80
- </Setter.Value>
81
- </Setter>
82
- </Style>
83
- </Window.Resources>
84
-
85
- <DocumentViewer>
86
- <FixedDocument>
87
- <PageContent>
88
- <FixedPage Width="5.0cm" Height="2.0cm">
89
- <Glyphs
90
- Fill="SteelBlue"
91
- FontRenderingEmSize="12"
92
- FontUri="C:\WINDOWS\Fonts\ARIAL.TTF"
93
- OriginX="50"
94
- OriginY="15"
95
- StyleSimulations="ItalicSimulation"
96
- UnicodeString="Hello World!" />
97
- </FixedPage>
98
- </PageContent>
99
- <PageContent>
100
- <FixedPage Width="5.0cm" Height="2.0cm">
101
- <Glyphs
102
- Fill="SteelBlue"
103
- FontRenderingEmSize="12"
104
- FontUri="C:\WINDOWS\Fonts\ARIAL.TTF"
105
- OriginX="50"
106
- OriginY="15"
107
- StyleSimulations="ItalicSimulation"
108
- UnicodeString="Hello World!" />
109
- </FixedPage>
110
- </PageContent>
111
- </FixedDocument>
112
- </DocumentViewer>
113
- </Window>
114
- ```
1
+ > これらの表示のされ方をカスタマイズすることは、DocumentViewerで可能でしょうか。
2
+
3
+ > 各ページの周りのボーダーライン(太さ、色など)
4
+ > 各ページの影(色、大きさ、透明度など)
5
+
6
+ 消すだけなら`ShowPageBorders`があります。
7
+ [DocumentViewer.ShowPageBorders プロパティ (System.Windows.Controls) | Microsoft Docs](https://docs.microsoft.com/ja-jp/dotnet/api/system.windows.controls.documentviewer.showpageborders?view=netcore-3.1)
8
+
9
+ > 縦並びの場合の、ページ間の距離
10
+
11
+ [DocumentViewer.VerticalPageSpacing プロパティ (System.Windows.Controls) | Microsoft Docs](https://docs.microsoft.com/ja-jp/dotnet/api/system.windows.controls.documentviewer.verticalpagespacing?view=netcore-3.1#System_Windows_Controls_DocumentViewer_VerticalPageSpacing)
12
+
13
+ > ページの表示方法(StackPanel のように単に並べたり、WrapPanel のように自動整列したり)
14
+ > を変更したいです。
15
+
16
+ これはさすがに無理じゃないですかね?(わかんないですけど)
17
+ `DocumentViewer`の改造というか、`DocumentViewer`のようなものを作ることになるんじゃないでしょうか。
18
+
19
+ ---
20
+
21
+ > 各ページの周りのボーダーライン(太さ、色など)
22
+ > 各ページの影(色、大きさ、透明度など)
23
+
24
+ .NET 6が使える場合は、自由に変えられるようになったようです。
25
+ [Use theme to create DocumentGridPage borders by wjk · Pull Request #2574 · dotnet/wpf](https://github.com/dotnet/wpf/pull/2574)
26
+
27
+ [wpf/DocumentViewer.xaml#L1207 at main · dotnet/wpf](https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Themes/XAML/DocumentViewer.xaml#L1207)
28
+
29
+ ```xml
30
+ <Window
31
+ x:Class="Questions366470.MainWindow"
32
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
34
+ Width="800"
35
+ Height="450">
36
+ <Window.Resources>
37
+ <Style
38
+ x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement},
39
+ ResourceId=DocumentGridPageContainerWithBorder}"
40
+ BasedOn="{x:Null}"
41
+ TargetType="ContentControl">
42
+ <Setter Property="FocusVisualStyle" Value="{x:Null}" />
43
+ <Setter Property="Template">
44
+ <Setter.Value>
45
+ <ControlTemplate TargetType="{x:Type ContentControl}">
46
+ <Grid>
47
+ <Grid.RowDefinitions>
48
+ <RowDefinition Height="5" />
49
+ <RowDefinition Height="*" />
50
+ <RowDefinition Height="5" />
51
+ </Grid.RowDefinitions>
52
+ <Grid.ColumnDefinitions>
53
+ <ColumnDefinition Width="5" />
54
+ <ColumnDefinition Width="*" />
55
+ <ColumnDefinition Width="5" />
56
+ </Grid.ColumnDefinitions>
57
+
58
+ <Border
59
+ Grid.RowSpan="2"
60
+ Grid.ColumnSpan="2"
61
+ Background="LightGray"
62
+ BorderBrush="Red"
63
+ BorderThickness="5">
64
+ <ContentPresenter />
65
+ </Border>
66
+
67
+ <Rectangle
68
+ Grid.Row="1"
69
+ Grid.Column="2"
70
+ Fill="Blue"
71
+ Opacity="0.35" />
72
+ <Rectangle
73
+ Grid.Row="2"
74
+ Grid.Column="1"
75
+ Grid.ColumnSpan="2"
76
+ Fill="Blue"
77
+ Opacity="0.35" />
78
+ </Grid>
79
+ </ControlTemplate>
80
+ </Setter.Value>
81
+ </Setter>
82
+ </Style>
83
+ </Window.Resources>
84
+
85
+ <DocumentViewer>
86
+ <FixedDocument>
87
+ <PageContent>
88
+ <FixedPage Width="5.0cm" Height="2.0cm">
89
+ <Glyphs
90
+ Fill="SteelBlue"
91
+ FontRenderingEmSize="12"
92
+ FontUri="C:\WINDOWS\Fonts\ARIAL.TTF"
93
+ OriginX="50"
94
+ OriginY="15"
95
+ StyleSimulations="ItalicSimulation"
96
+ UnicodeString="Hello World!" />
97
+ </FixedPage>
98
+ </PageContent>
99
+ <PageContent>
100
+ <FixedPage Width="5.0cm" Height="2.0cm">
101
+ <Glyphs
102
+ Fill="SteelBlue"
103
+ FontRenderingEmSize="12"
104
+ FontUri="C:\WINDOWS\Fonts\ARIAL.TTF"
105
+ OriginX="50"
106
+ OriginY="15"
107
+ StyleSimulations="ItalicSimulation"
108
+ UnicodeString="Hello World!" />
109
+ </FixedPage>
110
+ </PageContent>
111
+ </FixedDocument>
112
+ </DocumentViewer>
113
+ </Window>
114
+ ```
115
115
  ![アプリ画像](6d6338fa60c96d087798d667591a0cad.png)