显示一个无窗口的 F​​orms PictureBox,总是在最上面 [英] Display a windowless Forms PictureBox, always on top

查看:35
本文介绍了显示一个无窗口的 F​​orms PictureBox,总是在最上面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写一个显示(多个)无窗口图片框的 windows 窗体应用程序,这些图片框始终显示在顶部",即始终可见?

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
---------------------

动机是图片框用于显示已知有时会死锁的第 3 方 Activex 视频控件的输出.通过将其置于单独的进程中,死锁的视频控件不会使整个应用程序死锁.

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.

推荐答案

FormBorderStyle=None 和 TopMost=true 会让你接近.并且当只向它们显示非对话框 .Show() 时,它们不会停止 ui 线程的执行.还提供一些功能来关闭它们.你应该为它定制一些东西(按钮),因为你不再有标准的控件框可见;) 想想一个带有图片框和它下面或上面的小工具栏(关闭、最小化)的自定义控件.

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.

这篇关于显示一个无窗口的 F​​orms PictureBox,总是在最上面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆