怎么不让某一程序界面永远在最前面

怎么不让某一程序界面永远在最前面,第1张

程序总是靠前是软件工程师开发的时候做的功能,而大多数软件都是没有设置默认总是靠前,有的软件设置项里面有总是靠前的功能,需要手动 *** 作。

腾讯QQ是工程师设定默认就是总是靠前的,当然在设置里面也能取消这一项。

你可以看看你所使用的软件设置项里面有没有类似QQ里的这个功能,如果有就可以让它总是靠在其他软件的前面。希望能对你有用

1、可以使用ShowDialog()。ShowDialog()将其置于程序最顶层,而且不能使用当前程序的其它窗体

2、可以设置Form.TopMost 属性为true,关于此属性的介绍:

Form.TopMost 属性

获取或设置一个值,指示该窗体是否应显示为最顶层窗体。

命名空间:System.Windows.Forms

程序集:System.Windows.Forms(在 system.windows.forms.dll 凳碰中)

参考代码与注释:

private void CreateMyTopMostForm()

{

  // Create lower form to display.

  Form bottomForm = new Form()

  // Display the lower form Maximized to 辩粗此demonstrate effect of TopMost property.

  bottomForm.WindowState = FormWindowState.Maximized

  // 携迅Display the bottom form.

  bottomForm.Show()

  // Create the top most form.

  Form topMostForm = new Form()

  // Set the size of the form larger than the default size.

  topMostForm.Size = new Size(300,300)

  // Set the position of the top most form to center of screen.

  topMostForm.StartPosition = FormStartPosition.CenterScreen

  // Display the form as top most form.

  topMostForm.TopMost = true

  topMostForm.Show()

}

两者二选一即可。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/12527152.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-26
下一篇 2023-05-26

发表评论

登录后才能评论

评论列表(0条)

保存