回答編集履歴

3

見直しキャンペーン中

2023/07/23 05:25

投稿

TN8001
TN8001

スコア9326

test CHANGED
@@ -1,9 +1,9 @@
1
1
  ### 空域問題(Airspace problem)
2
2
  WPFもフォームと同じで`WebBrowser`の上には重ねられません。
3
3
  `Chromium`だったらだいじょぶだったと思いますが、`WebBrowser`を使うなら同じようにウィンドウを重ねることになると思います。
4
+
4
- まだ何も手を付けていなければ
5
+ まだ何も手を付けていなければ、↓なんかはそのまま使えるかもしれません。
5
6
  [michaelsutton/hwnd-adorner: WPF library supporting layers (adornments) over any hwnd hosted by an HwndHost](https://github.com/michaelsutton/hwnd-adorner)
6
- こちらなんかはそのまま使えるかもしれません。
7
7
 
8
8
  ざっと試したところ動きました(ちょっとリサイズが重い気がするが、最悪参考にはなると思います)
9
9
 

2

見直しキャンペーン中

2023/07/23 05:22

投稿

TN8001
TN8001

スコア9326

test CHANGED
@@ -1,103 +1,53 @@
1
1
  ### 空域問題(Airspace problem)
2
-
3
- WPFもフォームと同じで`WebBrowser`の上には重ねられません。
2
+ WPFもフォームと同じで`WebBrowser`の上には重ねられません。
4
-
5
3
  `Chromium`だったらだいじょぶだったと思いますが、`WebBrowser`を使うなら同じようにウィンドウを重ねることになると思います。
6
-
7
4
  まだ何も手を付けていなければ
8
-
9
5
  [michaelsutton/hwnd-adorner: WPF library supporting layers (adornments) over any hwnd hosted by an HwndHost](https://github.com/michaelsutton/hwnd-adorner)
10
-
11
6
  こちらなんかはそのまま使えるかもしれません。
12
7
 
13
8
  ざっと試したところ動きました(ちょっとリサイズが重い気がするが、最悪参考にはなると思います)
14
9
 
15
-
16
-
17
10
  ### 描画方法
18
-
19
- `Canvas`では`Top` `Left`で座標指定ができるので、フォームと似た感覚で使えると思います。
11
+ `Canvas`では`Top``Left`で座標指定ができるので、フォームと似た感覚で使えると思います。
20
-
21
-
22
12
 
23
13
  ---
24
14
 
25
-
26
-
27
15
  追記
28
-
29
16
  デモプロジェクトから下記2ファイルのみ変更
30
17
 
31
-
32
-
33
- ```xaml
18
+ ```xml
34
-
35
19
  <UserControl
36
-
37
20
  x:Class="Demo.BrowserAdornment"
38
-
39
21
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
40
-
41
22
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
42
-
43
23
  <Canvas>
44
-
45
24
  <Label
46
-
47
25
  x:Name="label"
48
-
49
26
  Canvas.Left="0"
50
-
51
27
  FontSize="50"
52
-
53
28
  Foreground="DarkRed">
54
-
55
29
  Browser Adornment (;
56
-
57
30
  </Label>
58
-
59
31
  <Button Click="Button_Click" Content="aaa" />
60
-
61
32
  </Canvas>
62
-
63
33
  </UserControl>
64
-
65
34
  ```
66
35
 
67
-
68
-
69
- ```C#
36
+ ```cs
70
-
71
37
  using System.Windows;
72
-
73
38
  using System.Windows.Controls;
74
39
 
75
-
76
-
77
40
  namespace Demo
78
-
79
41
  {
80
-
81
42
  public partial class BrowserAdornment : UserControl
82
-
83
43
  {
84
-
85
44
  public BrowserAdornment() => InitializeComponent();
86
45
 
87
-
88
-
89
46
  private void Button_Click(object sender, RoutedEventArgs e)
90
-
91
47
  {
92
-
93
48
  Canvas.SetLeft(label, Canvas.GetLeft(label) + 10);
94
-
95
49
  label.Content = $"Canvas.Left{Canvas.GetLeft(label)}";
96
-
97
50
  }
98
-
99
51
  }
100
-
101
52
  }
102
-
103
53
  ```

1

追記

2020/09/09 03:44

投稿

TN8001
TN8001

スコア9326

test CHANGED
@@ -17,3 +17,87 @@
17
17
  ### 描画方法
18
18
 
19
19
  `Canvas`では`Top` `Left`で座標指定ができるので、フォームと似た感覚で使えると思います。
20
+
21
+
22
+
23
+ ---
24
+
25
+
26
+
27
+ 追記
28
+
29
+ デモプロジェクトから下記2ファイルのみ変更
30
+
31
+
32
+
33
+ ```xaml
34
+
35
+ <UserControl
36
+
37
+ x:Class="Demo.BrowserAdornment"
38
+
39
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
40
+
41
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
42
+
43
+ <Canvas>
44
+
45
+ <Label
46
+
47
+ x:Name="label"
48
+
49
+ Canvas.Left="0"
50
+
51
+ FontSize="50"
52
+
53
+ Foreground="DarkRed">
54
+
55
+ Browser Adornment (;
56
+
57
+ </Label>
58
+
59
+ <Button Click="Button_Click" Content="aaa" />
60
+
61
+ </Canvas>
62
+
63
+ </UserControl>
64
+
65
+ ```
66
+
67
+
68
+
69
+ ```C#
70
+
71
+ using System.Windows;
72
+
73
+ using System.Windows.Controls;
74
+
75
+
76
+
77
+ namespace Demo
78
+
79
+ {
80
+
81
+ public partial class BrowserAdornment : UserControl
82
+
83
+ {
84
+
85
+ public BrowserAdornment() => InitializeComponent();
86
+
87
+
88
+
89
+ private void Button_Click(object sender, RoutedEventArgs e)
90
+
91
+ {
92
+
93
+ Canvas.SetLeft(label, Canvas.GetLeft(label) + 10);
94
+
95
+ label.Content = $"Canvas.Left{Canvas.GetLeft(label)}";
96
+
97
+ }
98
+
99
+ }
100
+
101
+ }
102
+
103
+ ```