如何用c#使程序无形化?

发布于 2024-08-18 22:18:20 字数 132 浏览 9 评论 0原文

我只是想知道,是否有某种方法可以使程序(或程序的一部分)与 c# 变得无形。我想让人们可以看到该程序在那里,但如果他们单击,它会单击其下方的任何内容。我也想知道你是否可以做到这一点。有没有办法让一个项目不可见,可点击?

感谢您的帮助!

I just wanted to know, if there is someway to make a program (or part of a program) intangable with c#. I want to make it so that people can see the program is there, but if they were to click, it would click whatever is underneath it. I would also like to know if you can do that backwords. Is there someway to make an item that is invisable, clickable?

Thank you for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

雨的味道风的声音 2024-08-25 22:18:20

对于你模糊的问题,我给出一个模糊的回答:

听起来你的选择之一是可能的。您需要将收到的点击事件(消息)发送到适当的窗口(位于您的窗口下方的窗口)。我怀疑你必须从 C# 中 DllImport 一些东西才能做到这一点。

您的选项二虽然更困难,但也可能是可能的,因为您可以将代码注入其他正在运行的可执行文件中。这将是一个特权操作,您可能必须再次使用非 .NET dll 中的内容来从 C# 中执行此操作。请参阅 CodeProject 上的将代码注入另一个进程的三种方法

To your vague question, I offer a vague response:

Sounds like your option one is possible. You would need to send the click event (message) that you receive to the appropriate window (the one underneath yours). I suspect that you would have to DllImport some stuff to do this from c#.

Your option two, while more difficult, is probably also possible because you can inject code into other running executables. This will be a privileged operation, and you will likely again have to use stuff from non .NET dlls to do it from c#. See Three Ways to Inject Your Code into Another Process on CodeProject.

一笑百媚生 2024-08-25 22:18:20

如果您想向用户显示某些内容而不妨碍他们当时正在做的任何事情,您也许可以从任务栏上以气泡形式弹出消息?

这个问题的答案涵盖了这一点。或者,如果您很懒,这里是代码项目链接。

If you want to display something to a user without it getting in the way of whatever it was they were doing at the time you could pop up your messages in bubble from the task bar perhaps?

The answer to this question covers this. Or if you're lazy here's the code project link.

源来凯始玺欢你 2024-08-25 22:18:20

好吧,有时可能需要在屏幕上显示某些内容,而不是让它可点击(例如用于视频播放的屏幕显示以显示音量增加等。)

以下是如何在 C# 中实现此目的的示例 - 来自 codeproject: http://www.codeproject.com/KB/cs/OSDwindow.aspx

这使用 Win32 API ShowWindow(hWnd, SW_SHOWNOACTIVATE) 在不失去焦点的情况下显示窗口(无法选择)。

这是此调用的 MSDN 页面 ShowWindow

要显示不可见但可单击的窗口,您可以使用无边框的窗口 (FormBorderStyle=None) 并将透明度设置为 1%。

希望有帮助!

Ok so it sometimes might be necessary to show something on screen and not let it be clickable (like On-Screen-Display for video playback to show volume increase, etc..)

Here's an example of how to this in C# - from codeproject: http://www.codeproject.com/KB/cs/OSDwindow.aspx

This uses the Win32 API ShowWindow(hWnd, SW_SHOWNOACTIVATE) to present the window without losing focus (can't be selected).

And here's the MSDN page for this call ShowWindow

To display a window that is invisible but clickable you can use a window with no border (FormBorderStyle=None) and set transparency to 1%.

Hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文