0

I am using vb.net in windows mode and need some help with the design/formatting.

I have an image as a background and the image shows up entirely in design mode (not runtime) however during runtime the window resizes and becomes smaller than the image, meaning that the user would have to physically resize the window to make the interface fit. how would i make it so that the window launches at the right size to allow the image/interface to be seen fully.

Please see the below image for a better idea.

enter image description here

Link to full-size screen shot of runtime results

User59
  • 487
  • 4
  • 19

2 Answers2

1

Try to play with BackgroundImageLayout property of the form. Specify Stretch or Zoom.

1

This will center the image on the form, size the form to the image size, center the form and prevent the form from being resized

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
Chase Rocker
  • 1,908
  • 2
  • 13
  • 14