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

回答編集履歴

1

見直しキャンペーン中

2023/07/23 07:37

投稿

TN8001
TN8001

スコア10114

answer CHANGED
@@ -1,143 +1,141 @@
1
- スマホやゲームなどのチュートリアルで、ボタン等がアニメーションし(あるいはポップアップが出たりして)次の操作を促すようなものですよね?
2
- そしてそれ以外の操作はブロックし、数段階の一連の操作をユーザーにやらせてみるみたいな。
3
-
4
- それぞれ個別に考えれば、WPFでもそれほど難しくはありません。
5
- しかし一連の操作をチュートリアルとしてやらせようとすると、頭を抱えますね^^;(理屈上は可能だと思いますが、かなりのコードと状態管理が必要になりそう)
6
- サポートするようなライブラリも聞いたことないですし、やっている例も見たことありません(もしあったら私も参考にしたいです)
7
-
8
- 現実的には、
9
- * ツールチップやウォーターマーク等で説明を入れる
10
- * ツールチップやヘルプがあることをわかるように、?アイコンを表示する
11
- * 初回画面でのポップアップで動画再生
12
-
13
- あたりになるかなぁ?と思います。
14
-
15
- 理想を言えば、説明が要らないぐらい「シンプルでわかりやすいUIにする」ということなんでしょうけど^^;
16
-
17
- ---
18
-
19
- 一個一個の説明を順次出すだけでよければ、こんなのがお手軽でそこそこ見栄えもいいかもしれません(モーダルダイアログを吹き出し型にして、次々出すだけ)
20
-
21
- MainWindow.xaml
22
- ```xaml
23
- <Window
24
- x:Class="Questions296394.MainWindow"
25
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
26
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
27
- Width="450"
28
- Height="450"
29
- Loaded="Window_Loaded">
30
- <StackPanel>
31
- <Button
32
- x:Name="aaa"
33
- MinWidth="80"
34
- Margin="10"
35
- HorizontalAlignment="Center"
36
- Content="aaa" />
37
- <TextBox
38
- x:Name="bbb"
39
- MinWidth="80"
40
- Margin="10"
41
- HorizontalAlignment="Center"
42
- Text="bbb" />
43
- <Button
44
- x:Name="ccc"
45
- MinWidth="80"
46
- Margin="10"
47
- HorizontalAlignment="Center"
48
- Content="ccc" />
49
- </StackPanel>
50
- </Window>
51
- ```
52
- MainWindow.xaml.cs
53
- ```C#
54
- using System.Windows;
55
-
56
- namespace Questions296394
57
- {
58
- public partial class MainWindow : Window
59
- {
60
- public MainWindow() => InitializeComponent();
61
-
62
- private void Window_Loaded(object sender, RoutedEventArgs e)
63
- {
64
- var p = aaa.PointToScreen(new Point(aaa.ActualWidth + 10, 0));
65
- var b = new BalloonWindow { Left = p.X, Top = p.Y, Title = "aaaの説明", Content = "なんたらかんたら", Owner = this, };
66
- b.ShowDialog();
67
-
68
- p = bbb.PointToScreen(new Point(bbb.ActualWidth + 10, 0));
69
- b = new BalloonWindow { Left = p.X, Top = p.Y, Title = "bbbの説明", Content = "ほげほげふがふが", Owner = this, };
70
- b.ShowDialog();
71
-
72
- p = ccc.PointToScreen(new Point(ccc.ActualWidth + 10, 0));
73
- b = new BalloonWindow { Left = p.X, Top = p.Y, Title = "cccの説明", Content = "なんたらかんたら\nほげほげふがふが", Owner = this, };
74
- b.ShowDialog();
75
- }
76
- }
77
- }
78
- ```
79
-
80
- BalloonWindow.xaml
81
- ```xaml
82
- <Window
83
- x:Class="Questions296394.BalloonWindow"
84
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
85
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
86
- <Window.Style>
87
- <Style TargetType="{x:Type Window}">
88
- <Setter Property="AllowsTransparency" Value="True" />
89
- <Setter Property="SizeToContent" Value="WidthAndHeight" />
90
- <Setter Property="WindowStyle" Value="None" />
91
- <Setter Property="Template">
92
- <Setter.Value>
93
- <ControlTemplate TargetType="{x:Type Window}">
94
- <Grid>
95
- <Border
96
- Margin="20,0,0,0"
97
- Padding="10"
98
- Background="WhiteSmoke"
99
- BorderBrush="Black"
100
- BorderThickness="2"
101
- CornerRadius="10">
102
- <StackPanel>
103
- <TextBlock
104
- HorizontalAlignment="Center"
105
- FontSize="20"
106
- Text="{TemplateBinding Title}" />
107
- <ContentPresenter Margin="10" Content="{TemplateBinding Content}" />
108
- <Button
109
- HorizontalAlignment="Right"
110
- Click="Button_Click"
111
- Content="OK" />
112
- </StackPanel>
113
- </Border>
114
- <Polygon
115
- Fill="WhiteSmoke"
116
- Points="2,20 20,20 20,40"
117
- Stroke="Black"
118
- StrokeThickness="4" />
119
- <Polygon Fill="WhiteSmoke" Points="2,20 22,20 22,42" />
120
- </Grid>
121
- </ControlTemplate>
122
- </Setter.Value>
123
- </Setter>
124
- </Style>
125
- </Window.Style>
126
- </Window>
127
- ```
128
- BalloonWindow.xaml.cs
129
- ```C#
130
- using System.Windows;
131
-
132
- namespace Questions296394
133
- {
134
- public partial class BalloonWindow : Window
135
- {
136
- public BalloonWindow() => InitializeComponent();
137
-
138
- private void Button_Click(object sender, RoutedEventArgs e) => DialogResult = true;
139
- }
140
- }
141
- ```
142
-
1
+ スマホやゲームなどのチュートリアルで、ボタン等がアニメーションし(あるいはポップアップが出たりして)次の操作を促すようなものですよね?
2
+ そしてそれ以外の操作はブロックし、数段階の一連の操作をユーザーにやらせてみるみたいな。
3
+
4
+ それぞれ個別に考えれば、WPFでもそれほど難しくはありません。
5
+ しかし一連の操作をチュートリアルとしてやらせようとすると、頭を抱えますね^^;(理屈上は可能だと思いますが、かなりのコードと状態管理が必要になりそう)
6
+ サポートするようなライブラリも聞いたことないですし、やっている例も見たことありません(もしあったら私も参考にしたいです)
7
+
8
+ 現実的には、
9
+ * ツールチップやウォーターマーク等で説明を入れる
10
+ * ツールチップやヘルプがあることをわかるように、?アイコンを表示する
11
+ * 初回画面でのポップアップで動画再生
12
+
13
+ あたりになるかなぁ?と思います。
14
+
15
+ 理想を言えば、説明が要らないぐらい「シンプルでわかりやすいUIにする」ということなんでしょうけど^^;
16
+
17
+ ---
18
+
19
+ 一個一個の説明を順次出すだけでよければ、こんなのがお手軽でそこそこ見栄えもいいかもしれません(モーダルダイアログを吹き出し型にして、次々出すだけ)
20
+
21
+ ```xml:MainWindow.xaml
22
+ <Window
23
+ x:Class="Questions296394.MainWindow"
24
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
25
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
26
+ Width="450"
27
+ Height="450"
28
+ Loaded="Window_Loaded">
29
+ <StackPanel>
30
+ <Button
31
+ x:Name="aaa"
32
+ MinWidth="80"
33
+ Margin="10"
34
+ HorizontalAlignment="Center"
35
+ Content="aaa" />
36
+ <TextBox
37
+ x:Name="bbb"
38
+ MinWidth="80"
39
+ Margin="10"
40
+ HorizontalAlignment="Center"
41
+ Text="bbb" />
42
+ <Button
43
+ x:Name="ccc"
44
+ MinWidth="80"
45
+ Margin="10"
46
+ HorizontalAlignment="Center"
47
+ Content="ccc" />
48
+ </StackPanel>
49
+ </Window>
50
+ ```
51
+
52
+ ```cs:MainWindow.xaml.cs
53
+ using System.Windows;
54
+
55
+ namespace Questions296394
56
+ {
57
+ public partial class MainWindow : Window
58
+ {
59
+ public MainWindow() => InitializeComponent();
60
+
61
+ private void Window_Loaded(object sender, RoutedEventArgs e)
62
+ {
63
+ var p = aaa.PointToScreen(new Point(aaa.ActualWidth + 10, 0));
64
+ var b = new BalloonWindow { Left = p.X, Top = p.Y, Title = "aaaの説明", Content = "なんたらかんたら", Owner = this, };
65
+ b.ShowDialog();
66
+
67
+ p = bbb.PointToScreen(new Point(bbb.ActualWidth + 10, 0));
68
+ b = new BalloonWindow { Left = p.X, Top = p.Y, Title = "bbbの説明", Content = "ほげほげふがふが", Owner = this, };
69
+ b.ShowDialog();
70
+
71
+ p = ccc.PointToScreen(new Point(ccc.ActualWidth + 10, 0));
72
+ b = new BalloonWindow { Left = p.X, Top = p.Y, Title = "cccの説明", Content = "なんたらかんたら\nほげほげふがふが", Owner = this, };
73
+ b.ShowDialog();
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ ```xml:BalloonWindow.xaml
80
+ <Window
81
+ x:Class="Questions296394.BalloonWindow"
82
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
83
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
84
+ <Window.Style>
85
+ <Style TargetType="{x:Type Window}">
86
+ <Setter Property="AllowsTransparency" Value="True" />
87
+ <Setter Property="SizeToContent" Value="WidthAndHeight" />
88
+ <Setter Property="WindowStyle" Value="None" />
89
+ <Setter Property="Template">
90
+ <Setter.Value>
91
+ <ControlTemplate TargetType="{x:Type Window}">
92
+ <Grid>
93
+ <Border
94
+ Margin="20,0,0,0"
95
+ Padding="10"
96
+ Background="WhiteSmoke"
97
+ BorderBrush="Black"
98
+ BorderThickness="2"
99
+ CornerRadius="10">
100
+ <StackPanel>
101
+ <TextBlock
102
+ HorizontalAlignment="Center"
103
+ FontSize="20"
104
+ Text="{TemplateBinding Title}" />
105
+ <ContentPresenter Margin="10" Content="{TemplateBinding Content}" />
106
+ <Button
107
+ HorizontalAlignment="Right"
108
+ Click="Button_Click"
109
+ Content="OK" />
110
+ </StackPanel>
111
+ </Border>
112
+ <Polygon
113
+ Fill="WhiteSmoke"
114
+ Points="2,20 20,20 20,40"
115
+ Stroke="Black"
116
+ StrokeThickness="4" />
117
+ <Polygon Fill="WhiteSmoke" Points="2,20 22,20 22,42" />
118
+ </Grid>
119
+ </ControlTemplate>
120
+ </Setter.Value>
121
+ </Setter>
122
+ </Style>
123
+ </Window.Style>
124
+ </Window>
125
+ ```
126
+
127
+ ```cs:BalloonWindow.xaml.cs
128
+ using System.Windows;
129
+
130
+ namespace Questions296394
131
+ {
132
+ public partial class BalloonWindow : Window
133
+ {
134
+ public BalloonWindow() => InitializeComponent();
135
+
136
+ private void Button_Click(object sender, RoutedEventArgs e) => DialogResult = true;
137
+ }
138
+ }
139
+ ```
140
+
143
141
  ![イメージ説明](12dada25bca5b1919107b2767f1ffac5.png)