如何制作不可移动的表格? [英] How can I make a Form NON-MOVABLE?

查看:112
本文介绍了如何制作不可移动的表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个不可移动的表格。我怎样才能做到这一点???我已经把它变成了不可调整大小的,现在我只需要让它不可移动。

提前致谢!

I am trying to make a Form Non-Movable. How can I do this??? I have already made it non-resizable, now I just need to make it non-movable.
Thanks in advance!

推荐答案

不要这样做......



将窗口移动到想要显示的位置。如果你真的想要它,那么也许你可以确保如果用户移动窗口它在一台显示器上保持可见。



你的用户可能会感到沮丧能够移动窗户。例如,用户可能会改变他的显示器分辨率,有多个显示器(他可能更喜欢在另一个显示器上显示该窗口)。用户可能会使用其中一个屏幕进行全屏应用,然后更喜欢将您的应用程序放在另一台显示器上。



顺便提一下,它会阻止您的窗口在移动时,系统在更改资源时可能会被移动(取决于你的工作方式)。



用户可以安装一些第三方产品或写无论如何都要移动窗户。



您必须正确处理分辨率,监视器,桌面区域的更改(例如,如果用户拖动任务栏)另一方面,默认)。



另一个应用程序可能已经决定对你做同样的事情,因此重叠你的窗口,而用户无法对它做任何事情。



Windows是以这种方式设计的。那些违反规则的应用程序可能会被某些人讨厌。



这样做可能会迫使您在应用程序中使用不安全的代码。如果应用程序可能被编译为一个安全的应用程序,这将是一件非常糟糕的事情......
Don't do it...

Move the windows where you want it to appears. If you really want it, then perhaps you could ensure that if the user move the windows it stay visible on one monitor.

It can be frustrating to your user not to be able to move a windows. For example, the user might change his monitor resolution, have multiple monitor (he might then prefer to show that windows on another monitor). The user might use one of its screen for a full screen application and then prefer to have your application on another monitor.

By the way, it you prevent your windows from being moved, it might be moved anyway by the system when changing the resoution (depending on how you do it).

A user can install some third party product or write an utility to move the windows anyway.

You will have to correctly handle thing like changes of the resolutions, monitors, desktop area (for example if the user drag the taskbar on another side that the default).

Another application might have decided to do the same as you and thus overlap your windows without the user being able to do anything about it.

Windows was designed that way with a purpoose. Those that do applications that violate the rules might be hated by some.

Doing that might force you to have unsafe code in your application. If the application could underwise be compiled as a safe application, this would be a very bad thing...


奇怪的是,这实现起来非常简单:



Weird enough, this is ridiculously simple to achieve:

  1. 将以下代码添加到表单构造函数中:
  1. Add the following code to the the form constructor:
public NonMovableForm() {
   InitializeComponent();
   //add this:
   this.ShowInTaskbar = false;
   this.ControlBox = false;
   this.Text = null;
} //NonMovableForm

  • 如果你真的需要它,创建一个模拟标题栏的假控件,上面有关闭按钮(或不是),并将它停靠在表单的顶部。
  • 不要实现表单拖动。 : - )
  • 准备接收用户的多个投诉。
  • 利润?我不确定 - 看看上面的项目。




  • 无论如何,问题解决了。如果你真的需要它,请自行决定。



    -SA


    这是。只需将C#转换为VB.NET。
    Here it is. Just convert C# to VB.NET.


    这篇关于如何制作不可移动的表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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