简体   繁体   English

在64位Windows系统上安装32位VB6 GUI设计

[英]Install 32-bit VB6 GUI design on 64-bit windows system

I have a GUI designed with visual basic 6.0 on windows 32-bit system. 我在Windows 32位系统上使用Visual Basic 6.0设计了一个GUI。 I am trying to install it on windows-64 bit system. 我正在尝试将其安装在Windows 64位系统上。 When i install it on 64-bit windows system I am getting some problems in GUI like some text is missing on label or text-box. 当我将其安装在64位Windows系统上时,我在GUI中遇到一些问题,例如标签或文本框上缺少某些文本。 When i install it on 32-bit windows system it is working fine. 当我在32位Windows系统上安装它时,它工作正常。

I am confusing what might be the problem is it with the GUI design or installation? 我混淆了GUI设计或安装的问题可能是什么?

Thanks. 谢谢。

We've come across issues similar to this in the past, with certain control types/control settings not showing up in modern versions of Windows. 过去,我们遇到过类似的问题,某些控件类型/控件设置未在现代Windows版本中显示。

The work around we had was to set the Windows appearance theme to Windows Classic (looks mostly like XP). 我们要做的工作是将Windows外观主题设置为Windows Classic(看起来与XP相似)。 In the longer term we replaced those forms with controls that did work. 从长远来看,我们将这些表格替换为有效的控件。

Most controls don't have an AutoSize function, so you will have to do it yourself 大多数控件没有AutoSize功能,因此您必须自己做

Have a look at the TextWidth() function 看看TextWidth()函数

The controls you mention all have their text in the Caption propery, so you can do something as follows: 您提到的所有控件在Caption属性中都有其文本,因此您可以执行以下操作:

Option Explicit

Private Sub Command1_Click()
  Dim strLong As String
  strLong = String(50, "A")
  SetCaption Label1, strLong, 0
  SetCaption Check1, strLong, 480
  SetCaption Command1, strLong, 480
End Sub

Private Sub SetCaption(ctrl As Control, strCaption As String, sngMargin As Single)
  Dim sngWidth As Single
  sngWidth = TextWidth(strCaption)
  ctrl.Width = sngWidth + sngMargin
  ctrl.Caption = strCaption
End Sub

This is far from perfect, but it might work in your case. 这远非完美,但可能适合您的情况。

Some immediate remarks: 一些即时说明:

  • TextWidth() use the font from your form to calculate the width of the text TextWidth()使用表单中的字体来计算文本的宽度
  • Not all controls have a Caption property. 并非所有控件都具有Caption属性。 For a textbox you will have to use the Text property, so you can't the SetCaption function 对于文本框,您将必须使用Text属性,因此不能使用SetCaption函数
  • Some controls need some extra space, for example the checkbox in the checkbox control or the borders around the command button control. 一些控件需要一些额外的空间,例如,复选框控件中的复选框或命令按钮控件周围的边框。 You have to figure out which margin works best 您必须弄清楚哪种边距效果最好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM