vb.net - 移动一个文本框会导致所有文本框和标签移动
问题描述
我正在 Visual Studio 2019 中开发一个 windowsforms vb.net 应用程序,今天我在移动控件时突然开始遇到一个奇怪的问题。
在一个表单上,每当我移动一个文本框时,它都会立即恢复到几乎原来的位置,并且表单上的所有其他文本框和标签都会稍微移动并重新调整大小。在其他表单上,我可以移动控件,但它也会稍微移动其他所有内容。当我查看表单设计器代码时,它来自之前:
'SpecsButton
'
Me.SpecsButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.SpecsButton.Location = New System.Drawing.Point(194, 25)
Me.SpecsButton.Name = "SpecsButton"
Me.SpecsButton.Size = New System.Drawing.Size(141, 44)
Me.SpecsButton.TabIndex = 113
Me.SpecsButton.Text = "Specs"
Me.SpecsButton.UseVisualStyleBackColor = True
'
'CastButton
'
Me.CastButton.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.CastButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CastButton.Location = New System.Drawing.Point(28, 25)
Me.CastButton.Name = "CastButton"
Me.CastButton.Size = New System.Drawing.Size(147, 44)
Me.CastButton.TabIndex = 112
Me.CastButton.Text = "Casts"
Me.CastButton.UseVisualStyleBackColor = True
'
'Button3
'
Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.Button3.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button3.Location = New System.Drawing.Point(103, 97)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(154, 42)
Me.Button3.TabIndex = 111
Me.Button3.Text = "Exit"
Me.Button3.UseVisualStyleBackColor = True
并在移动一个按钮后更改为:
SpecsButton
'
Me.SpecsButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.SpecsButton.Location = New System.Drawing.Point(129, 16)
Me.SpecsButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
Me.SpecsButton.Name = "SpecsButton"
Me.SpecsButton.Size = New System.Drawing.Size(94, 29)
Me.SpecsButton.TabIndex = 113
Me.SpecsButton.Text = "Specs"
Me.SpecsButton.UseVisualStyleBackColor = True
'
'CastButton
'
Me.CastButton.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.CastButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CastButton.Location = New System.Drawing.Point(27, 30)
Me.CastButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
Me.CastButton.Name = "CastButton"
Me.CastButton.Size = New System.Drawing.Size(98, 29)
Me.CastButton.TabIndex = 112
Me.CastButton.Text = "Casts"
Me.CastButton.UseVisualStyleBackColor = True
'
'Button3
'
Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.Button3.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button3.Location = New System.Drawing.Point(69, 63)
Me.Button3.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(103, 27)
Me.Button3.TabIndex = 111
Me.Button3.Text = "Exit"
Me.Button3.UseVisualStyleBackColor = True
我对移动一件东西如何改变尺寸、位置以及在某些情况下改变表单上其他所有东西的填充完全感到困惑。
到目前为止我已经尝试过:
- 寻找控件设置中的任何差异。Locked 未设置为 true 或类似的值。自动缩放设置为字体。
- 尝试使用键盘箭头或对齐工具移动文本框
- 存储库存储在 GitHub 上,其他贡献者没有这个问题。与他们的工作副本同步并没有解决问题,也没有删除所有本地文件并从 GitHub 重新下载它们。他们也在使用 Visual Studio 2019
- 关闭计算机并再次打开
- 重新安装了visual studio然后尝试了Beta版
- 开始一个新项目 - 仍然有同样的问题
更糟糕的是,当我尝试撤消更改时,它并没有把东西放回原来的位置,实际上更多地移动它们!
我截取了一些截图 - 第一个是在尝试移动一个标签之后:
第二个是单击撤消后,一切都混乱了:
如果有人有任何建议,我将不胜感激,因为现在这使 Visual Studio 无法使用。
解决方案
推荐阅读
- c# - BLE GATT 在连接到 xamarin 表单中的异常“GattCallback 错误:133”后有时会断开连接
- javascript - Uncaught (in promise) 错误:Axios 中的请求失败,状态码为 404
- python - 尽管 2 年前使用相同的代码,但在训练模型时损失极高且准确率极低
- javascript - discord.js 嵌入:UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body embed.fields[0].value: 长度必须为 1024 或更少
- c# - 发生异常时,Postgres 连接状态保持活动状态
- c++ - 添加到 boost::accumulator 的值的数量是否有限制?
- python - ImportError:没有名为“xlsxwriter”的模块
- tableau-api - 在 Tableau Prep 中添加具有 NULL 值的列
- java - 在 SASL 身份验证期间尝试切换数据库目标
- python - 无法将路线从一个蓝图连接到另一个蓝图