单击win + D时,防止“无边框"形式最小化. [英] Preventing Border less form from minimizing while clicking win+D..

查看:93
本文介绍了单击win + D时,防止“无边框"形式最小化.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部..

我面临一个问题.我想防止在单击显示桌面"按钮或Win + D,Win + M
时,尽量减少无边框的表格

我搜索了google ..,并得到了相同的问题..

链接 [

Hai all..

I am facing one problem. I want to Prevent minimizing Border less form while clicking show desktop button or Win+D, Win+M

I searched google.. and got one same qustion..

Link[^]

In Delphi

I Got this:

procedure TForm1.WMShowWindow(var Msg: TWMShowWindow);
begin
  if not Msg.Show then
    Msg.Result := 0
  else
    inherited;
end;



但是在C#中需要相同的内容

我尝试过这段代码..



But need the same in C#

I tried this code..

protected override void DefWndProc(ref Message m)
{
    if (this.WindowState == FormWindowState.Minimized)
    {
        this.Show();
        this.WindowState = FormWindowState.Normal;
    }
    this.Activate();
    this.Focus();

    base.DefWndProc(ref m);
}



但是我的表格总是排在最前面..

我试过了



but my form is always in top..

I tried

this.SendToBack();


this.TopLevel=false;



但这并没有帮助我..

我该如何解决..?


请帮助我..?



but it didn''t helped me..

How can I solve this..?


Please help me..?

推荐答案

我同意上面关于更改标准Windows行为的评论.这是没有非常充分理由的不应该做的事情.

也就是说,您应该能够通过处理窗口的resize事件来覆盖此行为.如果窗口的状态已最小化,请将其更改为正常状态(我相信这是状态的名称,但是您可以弄清楚).
I agree with the comment above regarding changing standard Windows behavior. This is something you shouldn''t do without a very good reason.

That said, you should be able to override this behavior by handling the window''s resize event. If the window''s state is minimized, change it to normal (I believe that''s the name of the state, but you can figure it out).


这篇关于单击win + D时,防止“无边框"形式最小化.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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