用TopMost = true打开WinForms表单,但没有让它失去焦点吗? [英] Opening a WinForms Form with TopMost = true but not having it steal focus?

查看:56
本文介绍了用TopMost = true打开WinForms表单,但没有让它失去焦点吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个弹出式窗体,该窗体在用户的屏幕上弹出,并且具有 TopMost = true ,但是它占据了焦点。

I have a form that pops up on a user's screen and has TopMost=true, but it steals the focus. How can I get it to not steal focus when it first appears?

推荐答案

将此代码粘贴到您的表单:

Paste this code in your form:

protected override bool ShowWithoutActivation
{
    get { return true; }
}

这篇关于用TopMost = true打开WinForms表单,但没有让它失去焦点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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