【发布时间】:2018-04-04 22:14:10
【问题描述】:
我有一个奇怪的问题。当我使用 Windows 窗体(使用 Visual Basic)时,有时在设计器中对窗体布局进行编辑会导致窗体大小和组件布局自行更改。我自己没有在这里修改任何东西。以下是我正在谈论的一些图片:
我查看了 Designer 文件,这些是关于一个组件的一些示例差异。
编辑前。
'
'btnStop
'
Me.btnStop.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnStop.BackColor = System.Drawing.Color.Red
Me.btnStop.Enabled = False
Me.btnStop.Font = New System.Drawing.Font("Microsoft Sans Serif", 60.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnStop.ForeColor = System.Drawing.SystemColors.Control
Me.btnStop.Location = New System.Drawing.Point(546, 398)
Me.btnStop.Name = "btnStop"
Me.btnStop.Size = New System.Drawing.Size(450, 250)
Me.btnStop.TabIndex = 5
Me.btnStop.Text = "Stop"
Me.btnStop.UseVisualStyleBackColor = False
编辑后。
'
'btnStop
'
Me.btnStop.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnStop.BackColor = System.Drawing.Color.Red
Me.btnStop.Enabled = False
Me.btnStop.Font = New System.Drawing.Font("Microsoft Sans Serif", 60.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnStop.ForeColor = System.Drawing.SystemColors.Control
Me.btnStop.Location = New System.Drawing.Point(1092, 765)
Me.btnStop.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6)
Me.btnStop.Name = "btnStop"
Me.btnStop.Size = New System.Drawing.Size(900, 481)
Me.btnStop.TabIndex = 5
Me.btnStop.Text = "Stop"
Me.btnStop.UseVisualStyleBackColor = False
【问题讨论】:
-
我要检查的第一件事是您的表单的 AutoScaleMode。尝试改变,看看你是否有任何不同。 AutoScaleMode 无 > 字体 > Dpi > 继承