-->

Display a windowless Forms PictureBox, always on t

2019-06-14 06:22发布

问题:

How can I write an windows forms app that displays (multiple) windowless picture boxes, that are always shown 'on top' i.e. always visible?

The idea is for the app to be run at the same time as main application so that the picture boxes 'appear' as though they belong to main application but exist in a separate process. And, preferably the space between the displays remains clickable to the main app e.g.:

---------------------
|     --            |
|    |  | <---------|------App.exe
|     --    |       |
|     --    |       |
|    |  | <-        |
|     --            |
|                   |
|                   | <--- App2.exe
---------------------

Motivation is the picture boxes are used display the output of a 3rd party activex video control that is known to sometimes deadlock. By having it in a separate process the deadlocked video control will not deadlock the entire application.

回答1:

FormBorderStyle=None and TopMost=true will bring you close. And when showing them Non-Dialog just .Show() they won't stop the ui thread from executing. Also provide some functionality to close them as well. You should make something custom (button) for it because you don't have standard controlbox visible anymore ;) Think of a customcontrol with a picturebox and a little toolbar (close, minimize) underneath it or on top of it.