有没有办法防止 VB6 编译器打乱文件的内容? [英] Is there a way to prevent the VB6 compiler from shuffling the contents of files?

查看:15
本文介绍了有没有办法防止 VB6 编译器打乱文件的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于未知的原因,VB6 编译器通常喜欢重新排序 .vbp 文件的内容和 .frm 文件顶部的控件描述符块(描述窗体上控件属性的代码.您不这样做的代码)在 IDE 中看不到,但您可以在文本编辑器中看到,在版本控制中与以前的修订版本进行比较时.).在比较文件的修订版时,这非常烦人并且非常分散注意力.

For reasons unknown, the VB6 compiler often likes to reorder the contents of .vbp files and the control descriptor block at the top of .frm files (The code that describes the properties of controls on the form. Code that you don't see in the IDE but you do see in a text editor and when doing diffs against the previous revision in version control.). This is monumentally annoying and very distracting when comparing revisions of a file.

有没有办法防止这种情况发生?

Is there a way to prevent this?

推荐答案

我认为您对此无能为力.我注意到了同样的问题:IDE 似乎没有明显的原因喜欢重新排列事物.我注意到的一些事情:

I don't think there's much you can do about this. I've noticed the same problem: the IDE likes to rearrange things for seemingly no apparent reason. Some things I've noticed:

  • 当你使用 SSTab 控件时,VB喜欢重新排列属性选项卡,尤其是 TabEnabled财产.

  • When you use the SSTab control, VB likes to rearrange properties for tabs, especially the TabEnabled property.

对于项目文件,它是随机的重新排列文件的顺序出现,我想我记得看到类似文件类型的情况并不总是组合在一起并结束与项目混在一起特性.你没有对此进行很多控制,除非您通过某种类型的清理程序运行所有 VBP,这些清理程序将文件组合在一起(一组中的表单,另一组中的模块等)并按字母顺序或其他方式对它们进行排序,以便它们保持一致.处理此问题的一种可能方法是编写一个 IDE 插件,每次您将更改保存到项目文件时,它都会自动执行此操作,或者提出一些批处理过程,它只会递归您的源目录并清理所有 VBP一口气.

For project files, it randomly rearranges the order in which files appear and I think I remember seeing cases where similar file types are not always grouped together and end up mixed in with the project properties. You don't have much control over this, unless you run all your VBP's through some type of sanitizer that groups like files together (forms in one group, modules in another group, etc.) and sorts them alphabetically or something, so that they remain consistent. One possible way to handle this could be to write an IDE add-on that automatically does this everytime you save changes to a project file, or come up with some batch process that will just recurse over your source directories and clean up all the VBP's in one go.

IDE 似乎会随机更改事例;这似乎发生了经常项目参考.有时它们的输出较低案例,其他时候他们是大写输出.你可以得到通过选择忽略案例",当您比较文件时来源安全.

The IDE seems to randomly change the case of things; this seems to happen frequently to project references. Sometimes they are output in lower case, and other times they are output in upper case. You can get around this by choosing "Ignore Case" when you diff files in SourceSafe.

控制坐标,如Top、Left、Height 和 Width 可以不同同一表格的两次修订.这个到期了给不同的开发者使用不同的屏幕分辨率和/或在处理同一个表单时使用不同的屏幕 DPI 设置.如果你还没有这样做,我强烈建议你得到每个人都使用相同的开发分辨率和相同的 DPI 设置.不同的值是由舍入误差引起的出现逻辑画面时不同分辨率/DPI设置下的坐标转换为缇,默认VB 使用的坐标空间布置表格.此外,当我谈到这个话题时,让确保每个人都将显示设置为 96dpi,因为如果你在120dpi,有一个真的很好他们可能无法正确显示在设置为 96dpi 的显示器上.

Control coordinates, such Top, Left, Height, and Width, can differ between two revisions of the same form. This is due to different developers using different screen resolutions and/or different screen DPI settings while working on the same form. If you aren't doing this already, I highly recommend that you get everyone to develop using the same resolution and same DPI setting. The differing values are caused by rounding errors that occur when logical screen coordinates at different resolutions/DPI settings are converted to twips, the default coordinate space that VB uses for laying out forms. Additionally, while I'm on the topic, make sure everyone has their display set to 96dpi, because if you develop VB forms at 120dpi, there is a really really good chance they won't display correctly on a display set to 96dpi.

我可能还有其他事情现在想不起来了……

There are probably other things I can't remember right now...

至于表单文件中控件的顺序发生变化,这是正常的,如果碰巧从表单的一个版本更改为下一个版本,您通常不想尝试手动重新排列控件的顺序.控件出现在表单文件中的顺序决定了它们在表单上的 Z 顺序.如果 .frm 文件中控件的顺序发生变化,这将改变它们在表单上的相对 Z 顺序,这可能会导致表单显示方式出现意外结果.

As for the order of controls being changed in form files, this is normal, and you usually don't want to try rearrange the order of controls by hand if it happens to change from one revision of the form to the next. The order that the controls appear in a form file determines their Z-order on the form. If the order of the controls changes in the .frm file, this will change their relative Z-order on the form, which could lead to unintended results in how your forms are displayed.

这篇关于有没有办法防止 VB6 编译器打乱文件的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆