如何在vb.net中对面板和按钮进行编码以使其全屏显示 [英] how to code panels and buttons to make fullscreen in vb.net

查看:86
本文介绍了如何在vb.net中对面板和按钮进行编码以使其全屏显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚上好,

我想知道如何对面板和按钮进行编码,以便当表单全屏显示时,它们都应该移到我放置它们的正确位置.

这是我用来使表单全屏显示的代码:

Good evening people,

I would like to know how to code panels and buttons so that when the form goes fullscreen it should all move to the correct place to where I placed them.

Here''s the code I''m using to make the form full screen:

Private Sub FullscreenToolStripMenuItem_Click(ByVal sender As Object, 
                                              ByVal e As System.EventArgs) Handles FullscreenToolStripMenuItem.Click
    
    If FullscreenToolStripMenuItem.Checked = False Then
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        Me.WindowState = FormWindowState.Maximized
        Me.TopMost = True
        FullscreenToolStripMenuItem.Checked = True
    Else
        ' You can change this to the border style that you are currently using
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable 
        Me.WindowState = FormWindowState.Normal
        Me.TopMost = False
        FullscreenToolStripMenuItem.Checked = True
    End If
End Sub



我有3个面板和2个按钮.顺便说一句,该程序应在任何分辨率的全屏或任何尺寸的屏幕上运行.

在此先感谢



I have 3 panels and 2 buttons. By the way, the program should run on any resolution full screen or any screen size.

Thanks in advance

推荐答案

您好,

假设您是在Visual Studio的设计视图中设计UI的,请看使用Anchor属性来实现此效果.该属性将相对于窗体的边放置控件.它从表格的选定边锚定控件一定的距离-如果您选择相反的站点,它只会增加控件的宽度以使其起作用.所有控件的默认选择是左上角.

希望这会有所帮助,
Ed
Hi there,

Assuming you designed your UI in design view of Visual Studio, look at using the Anchor property to achieve this effect. The property will position controls relative to the sides of the form. It anchors controls a set distance from the selected sides of the form - if you select opposite sites it just increases the width of your control to make it work. The default selection for all controls is top-left.

Hope this helps,
Ed


这篇关于如何在vb.net中对面板和按钮进行编码以使其全屏显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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