单击另一个应用程序时保持表单打开 [英] Keep form open when clicking on another application

查看:24
本文介绍了单击另一个应用程序时保持表单打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我试图将它用作键盘来输入特殊字符.它目前有这个功能(不是我的代码!):

I've got an application that I'm trying to use as a keyboard to type special characters. It currently has this function (not my code!):

Protected Overrides ReadOnly Property CreateParams() As CreateParams
    Get
        Dim baseParams As CreateParams = MyBase.CreateParams

        Const WS_EX_NOACTIVATE As Integer = &H8000000
        Const WS_EX_TOOLWINDOW As Integer = &H80
        baseParams.ExStyle = baseParams.ExStyle Or CInt(WS_EX_NOACTIVATE Or WS_EX_TOOLWINDOW)

        Return baseParams
    End Get
End Property

这使得表单永远不会获得焦点,因为我不想按下表单上的按钮然后窃取焦点.但是,这也意味着当我在窗体外单击时,窗口会消失,因为它位于焦点应用程序的后面.使用这个程序的唯一方法是调整我想输入的应用程序的大小,并将窗口放在它旁边.换句话说,我只能这样使用它:

This makes it so the form never receives focus, as I don't want to press a button on the form and then steal the focus. However, it also means that when I click outside the form, the window disappear, as it's positioned behind the focused application. The only way to use this program is to resize the application I want to type in, and position the window next to it. In other words, I can only use it like this:

所以我想知道的是,我如何制作它以便我可以将此应用程序放置在我想在其中使用它的应用程序上,但是当我按下应用程序上的按钮时,它仍然没有关注那个窗户?

So what I want to know is, how do I make it so I can position this application over the application I want to use it in, but when I press a button on the application, it still doesn't focus on that window?

推荐答案

您可以在代码中添加 Me.Topmost = True 或将 Forms 属性设置为 TopMost> =

You can add Me.Topmost = True on your code or you can set the Forms Property to TopMost = True

这篇关于单击另一个应用程序时保持表单打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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