gpt4 book ai didi

c# - 删除边框 winforms 和 WindowState Maximized without fullscreen

转载 作者:太空狗 更新时间:2023-10-29 19:58:13 28 4
gpt4 key购买 nike

我遇到了以下问题,但我没有找到解决方案。

我想实现一个没有顶栏的 Winform,如果可能的话,没有边框。我尝试了几件事都没有成功,下面的方法可以完美地解决这个问题:

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

产生以下结果:

All work perfect ! But when i make it in maximized state

小问题是当我或用户触发最大化状态时,因为会使表单进入全屏模式!我不知道如何防止这种情况:

See ? You can't see the windows taskbar !

看到了吗?你看不到Windows任务栏!我正在使用

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

感谢您的帮助!

最佳答案

嗯!感谢您的所有回答,我终于用以下两种方法解决了

    private void MaximizeWindow() 
{
var rectangle = Screen.FromControl(this).Bounds;
this.FormBorderStyle = FormBorderStyle.None;
Size = new Size(rectangle.Width, rectangle.Height);
Location = new Point(0, 0);
Rectangle workingRectangle = Screen.PrimaryScreen.WorkingArea;
this.Size = new Size(workingRectangle.Width, workingRectangle.Height);
}

private void ResizableWindow()
{
this.ControlBox = false;
this.FormBorderStyle = FormBorderStyle.SizableToolWindow;
}

多亏了 X-TECH 和 Luïs,这个问题才得以解决!

Maximized state and the taskbar still there !

关于c# - 删除边框 winforms 和 WindowState Maximized without fullscreen,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32044808/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com