Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net Windows窗体在运行时未正确调整大小_Vb.net_Windows_Winforms - Fatal编程技术网

Vb.net Windows窗体在运行时未正确调整大小

Vb.net Windows窗体在运行时未正确调整大小,vb.net,windows,winforms,Vb.net,Windows,Winforms,我正在windows模式下使用vb.net,在设计/格式化方面需要一些帮助 我有一个图像作为背景,图像完全以设计模式(不是运行时)显示,但是在运行时,窗口会调整大小并变得比图像小,这意味着用户必须实际调整窗口大小以使界面适合。如何使窗口以正确的大小启动,以使图像/界面完全可见 请参阅下图以了解更好的想法 尝试使用表单的BackgroundImageLayout属性。指定拉伸或缩放这将使表单上的图像居中,将表单大小调整为图像大小,将表单居中,并防止调整表单大小 Private Sub Form1

我正在windows模式下使用vb.net,在设计/格式化方面需要一些帮助

我有一个图像作为背景,图像完全以设计模式(不是运行时)显示,但是在运行时,窗口会调整大小并变得比图像小,这意味着用户必须实际调整窗口大小以使界面适合。如何使窗口以正确的大小启动,以使图像/界面完全可见

请参阅下图以了解更好的想法


尝试使用表单的BackgroundImageLayout属性。指定拉伸缩放

这将使表单上的图像居中,将表单大小调整为图像大小,将表单居中,并防止调整表单大小

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    With Me
        .BackgroundImageLayout = ImageLayout.Center
        .Width = .BackgroundImage.Width
        .Height = .BackgroundImage.Height
        .Left = (Screen.FromControl(Me).WorkingArea.Width - Me.Width) / 2
        .Top = (Screen.FromControl(Me).WorkingArea.Height - Me.Height) / 2
        .FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
        .MaximizeBox = False
    End With
End Sub

您是否希望窗体可以调整大小?我希望窗体只显示UI,而不是重新调整大小。可能重复感谢您的帮助,找到了解决方案谢谢。我指定了拉伸,它做了我想要的。