回答編集履歴
1
見直しキャンペーン中
test
CHANGED
@@ -1,265 +1,133 @@
|
|
1
1
|
やりたいことは単純なうえ需要もありそうなのに、やってみると非常に難しいですね^^;
|
2
|
-
|
3
2
|
長々書いていますが、残念ながら満足いく解決法は見つかりませんでした。。。
|
4
3
|
|
5
|
-
|
6
|
-
|
7
4
|
普通に検索するとこの辺りがすぐ出てきます。
|
8
|
-
|
9
5
|
[c# - How can I make a paragraph corners round? - Stack Overflow](https://stackoverflow.com/questions/33367853/how-can-i-make-a-paragraph-corners-round)
|
10
|
-
|
11
|
-
|
12
6
|
|
13
7
|
[How do I surround Block content with Borders that have rounded corners?](https://social.msdn.microsoft.com/Forums/vstudio/en-US/7d7c5309-ff6a-403a-82f9-7714213d4122/how-do-i-surround-block-content-with-borders-that-have-rounded-corners)
|
14
8
|
|
15
|
-
|
16
|
-
|
17
9
|
しかし`BlockUIContainer`にくるむと、コレジャナイ感がすごいです(これでいいなら話は早いです)
|
18
10
|
|
19
|
-
|
20
|
-
|
21
11
|
2つ目のリンクで言及がある`Adorner`も↓をベースに検討しましたが、位置の更新以前に`Paragraph`のサイズ取得法が見つけられませんでした。
|
22
|
-
|
23
12
|
[Create custom FrameworkContentElement to add diagonal line over text in WPF - Stack Overflow](https://stackoverflow.com/questions/5432395/create-custom-frameworkcontentelement-to-add-diagonal-line-over-text-in-wpf)
|
24
|
-
|
25
|
-
|
26
13
|
|
27
14
|
`Paragraph`を改造?するような方法も探りましたが、`internal`まみれでどうしようもなさそうでした。
|
28
15
|
|
29
|
-
|
30
|
-
|
31
16
|
発想を変えて`Background`の`VisualBrush`に`Border`を突っ込むという雑な方法でそれっぽくはなりましたが、背景なので内側に描画になるのと`Width`・`Height`を実際のサイズに近い数字にしないと残念なことになります。
|
32
17
|
|
18
|
+
面倒なのでxamlで書きましたが、C#コードにするのは簡単でしょう。
|
19
|
+
```xml
|
20
|
+
<Window
|
21
|
+
x:Class="Questions356645.MainWindow"
|
22
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
23
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
24
|
+
Width="800"
|
25
|
+
Height="450">
|
26
|
+
<Grid>
|
27
|
+
<RichTextBox Margin="10" BorderThickness="0">
|
28
|
+
<FlowDocument>
|
29
|
+
<Paragraph
|
30
|
+
Margin="150,5,5,5"
|
31
|
+
BorderBrush="Aqua"
|
32
|
+
BorderThickness="1"
|
33
|
+
TextAlignment="Right">
|
34
|
+
<Run Text="normal" />
|
35
|
+
</Paragraph>
|
33
36
|
|
37
|
+
<BlockUIContainer>
|
38
|
+
<Border
|
39
|
+
Margin="150,5,5,5"
|
40
|
+
BorderBrush="Aqua"
|
41
|
+
BorderThickness="1"
|
42
|
+
CornerRadius="5">
|
43
|
+
<RichTextBox BorderThickness="0">
|
44
|
+
<FlowDocument>
|
45
|
+
<Paragraph TextAlignment="Right">
|
46
|
+
<Run Text="BlockUIContainer" />
|
47
|
+
</Paragraph>
|
48
|
+
</FlowDocument>
|
49
|
+
</RichTextBox>
|
50
|
+
</Border>
|
51
|
+
</BlockUIContainer>
|
34
52
|
|
53
|
+
<Paragraph Margin="150,5,5,5" TextAlignment="Right">
|
35
|
-
|
54
|
+
<Paragraph.Background>
|
36
|
-
|
37
|
-
|
55
|
+
<VisualBrush>
|
38
|
-
|
56
|
+
<VisualBrush.Visual>
|
39
|
-
<
|
57
|
+
<Border
|
40
|
-
|
41
|
-
x:Class="Questions356645.MainWindow"
|
42
|
-
|
43
|
-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
44
|
-
|
45
|
-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
46
|
-
|
47
|
-
Width="
|
58
|
+
Width="600"
|
48
|
-
|
49
|
-
Height="
|
59
|
+
Height="20"
|
50
|
-
|
60
|
+
BorderBrush="Aqua"
|
61
|
+
BorderThickness="1"
|
62
|
+
CornerRadius="5" />
|
63
|
+
</VisualBrush.Visual>
|
51
|
-
<
|
64
|
+
</VisualBrush>
|
52
|
-
|
65
|
+
</Paragraph.Background>
|
53
|
-
<R
|
66
|
+
<Run Text="VisualBrush" />
|
54
|
-
|
55
|
-
<
|
67
|
+
</Paragraph>
|
56
68
|
|
57
69
|
<Paragraph
|
58
|
-
|
59
70
|
Margin="150,5,5,5"
|
60
|
-
|
61
71
|
BorderBrush="Aqua"
|
62
|
-
|
63
|
-
BorderThickness="
|
72
|
+
BorderThickness="5"
|
64
|
-
|
65
73
|
TextAlignment="Right">
|
66
|
-
|
67
74
|
<Run Text="normal" />
|
68
|
-
|
69
75
|
</Paragraph>
|
70
76
|
|
71
|
-
|
72
|
-
|
73
77
|
<BlockUIContainer>
|
74
|
-
|
75
78
|
<Border
|
76
|
-
|
77
79
|
Margin="150,5,5,5"
|
78
|
-
|
79
80
|
BorderBrush="Aqua"
|
80
|
-
|
81
|
-
BorderThickness="
|
81
|
+
BorderThickness="5"
|
82
|
-
|
83
82
|
CornerRadius="5">
|
84
|
-
|
85
83
|
<RichTextBox BorderThickness="0">
|
86
|
-
|
87
84
|
<FlowDocument>
|
88
|
-
|
89
85
|
<Paragraph TextAlignment="Right">
|
90
|
-
|
91
86
|
<Run Text="BlockUIContainer" />
|
92
|
-
|
93
87
|
</Paragraph>
|
94
|
-
|
95
88
|
</FlowDocument>
|
96
|
-
|
97
89
|
</RichTextBox>
|
98
|
-
|
99
90
|
</Border>
|
100
|
-
|
101
91
|
</BlockUIContainer>
|
102
92
|
|
103
|
-
|
93
|
+
<Paragraph Margin="150,5,5,5" TextAlignment="Right">
|
94
|
+
<Paragraph.Background>
|
95
|
+
<VisualBrush>
|
96
|
+
<VisualBrush.Visual>
|
97
|
+
<Border
|
98
|
+
Width="600"
|
99
|
+
Height="20"
|
100
|
+
BorderBrush="Aqua"
|
101
|
+
BorderThickness="5"
|
102
|
+
CornerRadius="5" />
|
103
|
+
</VisualBrush.Visual>
|
104
|
+
</VisualBrush>
|
105
|
+
</Paragraph.Background>
|
106
|
+
<Run Text="VisualBrush" />
|
107
|
+
</Paragraph>
|
104
108
|
|
105
109
|
<Paragraph Margin="150,5,5,5" TextAlignment="Right">
|
106
|
-
|
107
110
|
<Paragraph.Background>
|
108
|
-
|
109
111
|
<VisualBrush>
|
110
|
-
|
111
112
|
<VisualBrush.Visual>
|
112
|
-
|
113
113
|
<Border
|
114
|
-
|
115
|
-
Width="
|
114
|
+
Width="100"
|
116
|
-
|
117
|
-
Height="
|
115
|
+
Height="100"
|
118
|
-
|
119
116
|
BorderBrush="Aqua"
|
120
|
-
|
121
117
|
BorderThickness="1"
|
122
|
-
|
123
118
|
CornerRadius="5" />
|
124
|
-
|
125
119
|
</VisualBrush.Visual>
|
126
|
-
|
127
120
|
</VisualBrush>
|
128
|
-
|
129
121
|
</Paragraph.Background>
|
130
|
-
|
131
122
|
<Run Text="VisualBrush" />
|
132
|
-
|
133
123
|
</Paragraph>
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<Paragraph
|
138
|
-
|
139
|
-
Margin="150,5,5,5"
|
140
|
-
|
141
|
-
BorderBrush="Aqua"
|
142
|
-
|
143
|
-
BorderThickness="5"
|
144
|
-
|
145
|
-
TextAlignment="Right">
|
146
|
-
|
147
|
-
<Run Text="normal" />
|
148
|
-
|
149
|
-
</Paragraph>
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
<BlockUIContainer>
|
154
|
-
|
155
|
-
<Border
|
156
|
-
|
157
|
-
Margin="150,5,5,5"
|
158
|
-
|
159
|
-
BorderBrush="Aqua"
|
160
|
-
|
161
|
-
BorderThickness="5"
|
162
|
-
|
163
|
-
CornerRadius="5">
|
164
|
-
|
165
|
-
<RichTextBox BorderThickness="0">
|
166
|
-
|
167
|
-
<FlowDocument>
|
168
|
-
|
169
|
-
<Paragraph TextAlignment="Right">
|
170
|
-
|
171
|
-
<Run Text="BlockUIContainer" />
|
172
|
-
|
173
|
-
</Paragraph>
|
174
|
-
|
175
|
-
</FlowDocument>
|
176
|
-
|
177
|
-
</RichTextBox>
|
178
|
-
|
179
|
-
</Border>
|
180
|
-
|
181
|
-
</BlockUIContainer>
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
<Paragraph Margin="150,5,5,5" TextAlignment="Right">
|
186
|
-
|
187
|
-
<Paragraph.Background>
|
188
|
-
|
189
|
-
<VisualBrush>
|
190
|
-
|
191
|
-
<VisualBrush.Visual>
|
192
|
-
|
193
|
-
<Border
|
194
|
-
|
195
|
-
Width="600"
|
196
|
-
|
197
|
-
Height="20"
|
198
|
-
|
199
|
-
BorderBrush="Aqua"
|
200
|
-
|
201
|
-
BorderThickness="5"
|
202
|
-
|
203
|
-
CornerRadius="5" />
|
204
|
-
|
205
|
-
</VisualBrush.Visual>
|
206
|
-
|
207
|
-
</VisualBrush>
|
208
|
-
|
209
|
-
</Paragraph.Background>
|
210
|
-
|
211
|
-
<Run Text="VisualBrush" />
|
212
|
-
|
213
|
-
</Paragraph>
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
<Paragraph Margin="150,5,5,5" TextAlignment="Right">
|
218
|
-
|
219
|
-
<Paragraph.Background>
|
220
|
-
|
221
|
-
<VisualBrush>
|
222
|
-
|
223
|
-
<VisualBrush.Visual>
|
224
|
-
|
225
|
-
<Border
|
226
|
-
|
227
|
-
Width="100"
|
228
|
-
|
229
|
-
Height="100"
|
230
|
-
|
231
|
-
BorderBrush="Aqua"
|
232
|
-
|
233
|
-
BorderThickness="1"
|
234
|
-
|
235
|
-
CornerRadius="5" />
|
236
|
-
|
237
|
-
</VisualBrush.Visual>
|
238
|
-
|
239
|
-
</VisualBrush>
|
240
|
-
|
241
|
-
</Paragraph.Background>
|
242
|
-
|
243
|
-
<Run Text="VisualBrush" />
|
244
|
-
|
245
|
-
</Paragraph>
|
246
|
-
|
247
124
|
</FlowDocument>
|
248
|
-
|
249
125
|
</RichTextBox>
|
250
|
-
|
251
126
|
</Grid>
|
252
|
-
|
253
127
|
</Window>
|
254
|
-
|
255
128
|
```
|
256
|
-
|
257
129
|
![アプリ画像](a908bb9cc2d1658048b095ca91579642.png)
|
258
|
-
|
259
|
-
|
260
130
|
|
261
131
|
---
|
262
132
|
|
263
|
-
|
264
|
-
|
265
133
|
もう「htmlかなんかでやったほうがマシなんじゃ?」という気はします^^;
|