开发者

WPF overlay across multiple windows

开发者 https://www.devze.com 2023-04-06 08:25 出处:网络
I have a WPF application using multiple independent windows. I would like to draw a line from one of the windows to another one. This needs to be controlled programmatically and if one of the wind开发

I have a WPF application using multiple independent windows. I would like to draw a line from one of the windows to another one. This needs to be controlled programmatically and if one of the wind开发者_开发问答ows is moved, this line needs to be updated accordingly.

What's the best way to do something like this? A transparent window on top of all others?


Ok, so all in all my solution is pretty simple and works well. I create a regular Window with Background=Transparent, ShowInTaskbar=False and the Size matching the screen (or multiple screens if attached). Additionally, I set TopMostto true. In this OverlayWindow I have a canvas where I can place objects or draw to. To allow other modules and windows of my application to draw overlays, I have a global OverlayManagerwhich allows to add and remove overlays, such as lines.

0

精彩评论

暂无评论...
验证码 换一张
取 消