删除边框WinForms和的WindowState最大化全屏无 [英] Remove borders winforms and WindowState Maximized without fullscreen

查看:267
本文介绍了删除边框WinForms和的WindowState最大化全屏无的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的麻烦,我没有找到一个解决方案。

I have the following trouble and i don't find a solution.

我要实现无顶栏一个WinForm,如果是可能的,无国界的。我试过几件事情没有成功,下面会做的伎俩完美的:

I want to implement a Winform without top bar and if is possible, without borders. I tried several things without success, the following would do the trick perfectly :

        this.Text = string.Empty;
        this.ControlBox = false;
        this.FormBorderStyle = FormBorderStyle.SizableToolWindow;



产生以下结果:

producing the following result :

< A HREF =http://i.stack.imgur.com/bX0mB.jpg相对=nofollow>

小问题是,当我还是用户触发最大化状态,因为会令形式在全屏模式下输入!我不知道如何来防止这种情况:

The little problem is when me or the user trigger the maximize state , because will make the form enter in a FULLSCREEN mode ! and i don't know how to prevent this:

看到了吗?你无法看到Windows任务栏!我使用

See? You can't see the windows taskbar ! I'm using

WindowState = FormWindowState.Maximized; // Makes a fullscreen that i dont want !



感谢您的帮助!

Appreciate your help !

推荐答案

动态试试这个设置的大小,它可以帮助你。

Try this to set size dynamically, it may helps you.

不要使用的WindowState = FormWindowState.Maximized。
试装的形式对这个代码

Do not use WindowState = FormWindowState.Maximized; Try this code on loading form

var rectangle = ScreenRectangle();
Size = new Size(rectangle.Width - 100, rectangle.Height - 100);
Location = new Point(50, 50);
// here 100 is pixel used to reserve from edges, 
// you can set lower value according to your requirements

有关全尺寸

var rectangle = ScreenRectangle();
Size = new Size(rectangle.Width, rectangle.Height);
Location = new Point(0, 0);



屏幕矩形方法是:

Screen Rectangle Method is:

public Rectangle ScreenRectangle()
{
    return Screen.FromControl(this).Bounds;
}

这篇关于删除边框WinForms和的WindowState最大化全屏无的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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