duup Ответов: 2

Открытая форма, все элементы управления слева вверху


Я разработал форму, но когда я открываю ее снова, все элементы управления размещаются в левом верхнем углу. Как устранить эту проблему?

Скриншот
01.15.2020-10.04.50[^]

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmProxy
  Inherits System.Windows.Forms.Form

  'Form overrides dispose to clean up the component list.
  <System.Diagnostics.DebuggerNonUserCode()>
  Protected Overrides Sub Dispose(ByVal disposing As Boolean)
    Try
      If disposing AndAlso components IsNot Nothing Then
        components.Dispose()
      End If
    Finally
      MyBase.Dispose(disposing)
    End Try
  End Sub

  'Required by the Windows Form Designer
  Private components As System.ComponentModel.IContainer

  'NOTE: The following procedure is required by the Windows Form Designer
  'It can be modified using the Windows Form Designer.  
  'Do not modify it using the code editor.
  <System.Diagnostics.DebuggerStepThrough()>
  Private Sub InitializeComponent()
        Me.TextBoxPassword = New System.Windows.Forms.TextBox()
        Me.lblComputerKey = New System.Windows.Forms.Label()
        Me.TextBoxUsername = New System.Windows.Forms.TextBox()
        Me.lblProductCode = New System.Windows.Forms.Label()
        Me.txtPort = New System.Windows.Forms.TextBox()
        Me.txtServer = New System.Windows.Forms.TextBox()
        Me.lblUserName = New System.Windows.Forms.Label()
        Me.cmdCancel = New System.Windows.Forms.Button()
        Me.cmdClose = New System.Windows.Forms.Button()
        Me.CheckBoxUseProxy = New System.Windows.Forms.CheckBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.CheckBoxAuthentication = New System.Windows.Forms.CheckBox()
        Me.SuspendLayout()
        '
        'TextBoxPassword
        '
        Me.TextBoxPassword.AcceptsReturn = True
        Me.TextBoxPassword.BackColor = System.Drawing.SystemColors.Window
        Me.TextBoxPassword.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.TextBoxPassword.ForeColor = System.Drawing.SystemColors.WindowText
        Me.TextBoxPassword.ImeMode = System.Windows.Forms.ImeMode.Disable
        Me.TextBoxPassword.Location = New System.Drawing.Point(131, 117)
        Me.TextBoxPassword.MaxLength = 0
        Me.TextBoxPassword.Name = "TextBoxPassword"
        Me.TextBoxPassword.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)
        Me.TextBoxPassword.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.TextBoxPassword.Size = New System.Drawing.Size(269, 20)
        Me.TextBoxPassword.TabIndex = 5
        '
        'lblComputerKey
        '
        Me.lblComputerKey.BackColor = System.Drawing.SystemColors.Control
        Me.lblComputerKey.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblComputerKey.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblComputerKey.Location = New System.Drawing.Point(49, 120)
        Me.lblComputerKey.Name = "lblComputerKey"
        Me.lblComputerKey.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblComputerKey.Size = New System.Drawing.Size(122, 20)
        Me.lblComputerKey.TabIndex = 32
        Me.lblComputerKey.Text = "Password:"
        '
        'TextBoxUsername
        '
        Me.TextBoxUsername.AcceptsReturn = True
        Me.TextBoxUsername.BackColor = System.Drawing.SystemColors.Window
        Me.TextBoxUsername.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.TextBoxUsername.ForeColor = System.Drawing.SystemColors.WindowText
        Me.TextBoxUsername.ImeMode = System.Windows.Forms.ImeMode.Disable
        Me.TextBoxUsername.Location = New System.Drawing.Point(131, 89)
        Me.TextBoxUsername.MaxLength = 0
        Me.TextBoxUsername.Name = "TextBoxUsername"
        Me.TextBoxUsername.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.TextBoxUsername.Size = New System.Drawing.Size(269, 20)
        Me.TextBoxUsername.TabIndex = 4
        '
        'lblProductCode
        '
        Me.lblProductCode.BackColor = System.Drawing.SystemColors.Control
        Me.lblProductCode.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblProductCode.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblProductCode.Location = New System.Drawing.Point(49, 92)
        Me.lblProductCode.Name = "lblProductCode"
        Me.lblProductCode.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblProductCode.Size = New System.Drawing.Size(122, 20)
        Me.lblProductCode.TabIndex = 31
        Me.lblProductCode.Text = "Username:"
        '
        'txtPort
        '
        Me.txtPort.AcceptsReturn = True
        Me.txtPort.BackColor = System.Drawing.SystemColors.Window
        Me.txtPort.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtPort.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtPort.ImeMode = System.Windows.Forms.ImeMode.Disable
        Me.txtPort.Location = New System.Drawing.Point(414, 35)
        Me.txtPort.MaxLength = 0
        Me.txtPort.Name = "txtPort"
        Me.txtPort.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtPort.Size = New System.Drawing.Size(42, 20)
        Me.txtPort.TabIndex = 2
        Me.txtPort.Text = "8080"
        Me.txtPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'txtServer
        '
        Me.txtServer.AcceptsReturn = True
        Me.txtServer.BackColor = System.Drawing.SystemColors.Window
        Me.txtServer.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.txtServer.ForeColor = System.Drawing.SystemColors.WindowText
        Me.txtServer.Location = New System.Drawing.Point(131, 35)
        Me.txtServer.MaxLength = 0
        Me.txtServer.Name = "txtServer"
        Me.txtServer.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.txtServer.Size = New System.Drawing.Size(269, 20)
        Me.txtServer.TabIndex = 1
        Me.txtServer.Text = "127.0.0.1"
        '
        'lblUserName
        '
        Me.lblUserName.BackColor = System.Drawing.SystemColors.Control
        Me.lblUserName.Cursor = System.Windows.Forms.Cursors.Default
        Me.lblUserName.ForeColor = System.Drawing.SystemColors.ControlText
        Me.lblUserName.Location = New System.Drawing.Point(29, 38)
        Me.lblUserName.Name = "lblUserName"
        Me.lblUserName.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.lblUserName.Size = New System.Drawing.Size(122, 20)
        Me.lblUserName.TabIndex = 29
        Me.lblUserName.Text = "Proxy server:"
        '
        'cmdCancel
        '
        Me.cmdCancel.BackColor = System.Drawing.SystemColors.Control
        Me.cmdCancel.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.cmdCancel.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdCancel.Location = New System.Drawing.Point(242, 151)
        Me.cmdCancel.Name = "cmdCancel"
        Me.cmdCancel.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdCancel.Size = New System.Drawing.Size(104, 23)
        Me.cmdCancel.TabIndex = 6
        Me.cmdCancel.Text = "Cancel"
        Me.cmdCancel.UseVisualStyleBackColor = False
        '
        'cmdClose
        '
        Me.cmdClose.BackColor = System.Drawing.SystemColors.Control
        Me.cmdClose.Cursor = System.Windows.Forms.Cursors.Default
        Me.cmdClose.ForeColor = System.Drawing.SystemColors.ControlText
        Me.cmdClose.Location = New System.Drawing.Point(352, 151)
        Me.cmdClose.Name = "cmdClose"
        Me.cmdClose.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.cmdClose.Size = New System.Drawing.Size(104, 23)
        Me.cmdClose.TabIndex = 7
        Me.cmdClose.Text = "Close"
        Me.cmdClose.UseVisualStyleBackColor = False
        '
        'CheckBoxUseProxy
        '
        Me.CheckBoxUseProxy.AutoSize = True
        Me.CheckBoxUseProxy.Location = New System.Drawing.Point(12, 12)
        Me.CheckBoxUseProxy.Name = "CheckBoxUseProxy"
        Me.CheckBoxUseProxy.Size = New System.Drawing.Size(74, 17)
        Me.CheckBoxUseProxy.TabIndex = 0
        Me.CheckBoxUseProxy.Text = "Use Proxy"
        Me.CheckBoxUseProxy.UseVisualStyleBackColor = True
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(403, 38)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(10, 13)
        Me.Label1.TabIndex = 34
        Me.Label1.Text = ":"
        '
        'CheckBoxAuthentication
        '
        Me.CheckBoxAuthentication.AutoSize = True
        Me.CheckBoxAuthentication.Location = New System.Drawing.Point(32, 66)
        Me.CheckBoxAuthentication.Name = "CheckBoxAuthentication"
        Me.CheckBoxAuthentication.Size = New System.Drawing.Size(123, 17)
        Me.CheckBoxAuthentication.TabIndex = 3
        Me.CheckBoxAuthentication.Text = "Proxy Authentication"
        Me.CheckBoxAuthentication.UseVisualStyleBackColor = True
        '
        'frmProxy
        '
        Me.AcceptButton = Me.cmdClose
        Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.font
        Me.CancelButton = Me.cmdCancel
        Me.ClientSize = New System.Drawing.Size(468, 186)
        Me.Controls.Add(Me.CheckBoxAuthentication)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.CheckBoxUseProxy)
        Me.Controls.Add(Me.TextBoxPassword)
        Me.Controls.Add(Me.lblComputerKey)
        Me.Controls.Add(Me.TextBoxUsername)
        Me.Controls.Add(Me.lblProductCode)
        Me.Controls.Add(Me.txtPort)
        Me.Controls.Add(Me.txtServer)
        Me.Controls.Add(Me.lblUserName)
        Me.Controls.Add(Me.cmdCancel)
        Me.Controls.Add(Me.cmdClose)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmProxy"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Proxy settings"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

    Public WithEvents TextBoxPassword As Windows.Forms.TextBox
    Public WithEvents lblComputerKey As Windows.Forms.Label
    Public WithEvents TextBoxUsername As Windows.Forms.TextBox
    Public WithEvents lblProductCode As Windows.Forms.Label
    Public WithEvents txtPort As Windows.Forms.TextBox
    Public WithEvents txtServer As Windows.Forms.TextBox
    Public WithEvents lblUserName As Windows.Forms.Label
    Public WithEvents cmdCancel As Windows.Forms.Button
    Public WithEvents cmdClose As Windows.Forms.Button
    Friend WithEvents CheckBoxUseProxy As Windows.Forms.CheckBox
    Friend WithEvents Label1 As Windows.Forms.Label
    Friend WithEvents CheckBoxAuthentication As Windows.Forms.CheckBox
End Class


Что я уже пробовал:

кажется, ничего не работает, кроме редизайна

2 Ответов

Рейтинг:
0

OriginalGriff

Попробуйте расширить свою форму - на данный момент она выглядит так, как будто она размером с почтовую марку, и это может быть причиной вашей проблемы.


duup

Нет, я могу сделать форму больше, но все элементы управления остаются в исходном положении (слева вверху)

Рейтинг:
0

duup

Найти решение.
В моем коде файла конструктора была такая строка:

Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.font

Когда изменился на .DPI, то он загружается нормально.