C# VS2008 - 为什么我的 DataGridViewCellStyle 变量自动重命名?
第一篇文章!潜伏多年,但谷歌搜索这个问题还没有找到任何结果。所以这里...
我有几个 C# WinForms 应用程序在 Visual Studio 2008 中表现出这种行为,但我想我在使用 Visual Studio 2005 时也注意到了同样的问题。主窗体包含一个选项卡控件,在几个子选项卡上我有一些 DataGridView 控件。我使用设计器添加和自定义所有列。
我对这些列唯一自定义的是它们的 HeaderText、MaxInputLength 和 Name。在本例中,我正在处理数字条目,因此我修改了 DefaultCellStyle 下的一件事“Alignment=TopRight”(替换“NotSet”)以正确显示数字条目。
所以问题就在这里。每当我检查主窗体中其他地方的代码更改(例如 FormMain.Designer.cs 被修改)时,我都会看到某些东西神奇地重新编号了我的 DataGridViewCellStyle 变量名称!
在整个 FormMain.Designer.cs 中,我以前拥有“dataGridVewCellStyle1”的任何地方都已重命名为“dataGridViewCellStyle3”,并且编号为 2 的变量已重新编号为 4。就像这样:
dataGridViewCellStyle1 -> dataGridViewCellStyle3
dataGridViewCellStyle2 -> dataGridViewCellStyle4
一旦我有一个包含大约 8 个不同的自定义单元格样式的项目,时不时地,它们都会被我在表格上其他地方看到的东西神奇地重新编号。经过多次登记,人数增加到了 50 和 60 多位。这些单元格样式均未修改;他们刚刚被重新编号。
这比什么都烦人。你们也见过这个吗,你知道是否存在某种模式,我该怎么办?
提前致谢!
FIRST POST! Been lurking for years, but Googling on this issue hasn't turned up any results. So here goes...
I have several C# WinForms apps exhibiting this behavior in Visual Studio 2008, but I think I noticed this same problem back when I was working with Visual Studio 2005 as well. The main form contains a tab control, and on several sub-tabs I have a few DataGridView control. I used the designer to add and customize all columns.
The only thing I've customized about these columns is their HeaderText, MaxInputLength, and Name. In this case I'm working with numeric entries, so I modified one thing under the DefaultCellStyle, "Alignment=TopRight" (replacing "NotSet") to display numeric entries properly.
So here's the problem. Every so often as I'm checking in code changes from elsewhere in my main form, such that FormMain.Designer.cs is modified, I see something has magically renumbered my DataGridViewCellStyle variable names!
All throughout FormMain.Designer.cs, anywhere I previously had "dataGridVewCellStyle1" has been renamed to "dataGridViewCellStyle3", and my variable numbered 2 has been renumbered to 4. Like so:
dataGridViewCellStyle1 -> dataGridViewCellStyle3
dataGridViewCellStyle2 -> dataGridViewCellStyle4
Once I had a project with about 8 different customized cell styles, and every so often they were all renumbered magically by something I saw doing elsewhere on that form. After several check-ins, the numbers were up in the 50's and 60's. None of those cell styles were modified; they just got renumbered.
This is more annoying than anything. Have any of you seen this too, do you know if there's a pattern, what what can I do about it?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论