更改程序显示语言版本的2个函数,只是个思路...
2005-09-06 09:34
447 查看
'
'
'原创: 许仙; qq:19030300 主页:http://jjweb.126.com
'转载请保持信息的完整性 谢谢
'——————————————————————————————————
'将控件更改语言版本
'针对各个窗体读取控件信息写入控件信息
Public Function manageVer(strVer As String, Optional frmName As String)
'不传参数所以窗体全部改变版本
On Error Resume Next
Dim rs As New ADODB.Recordset
Dim i, k, ctl As Control, l
For i = 0 To Forms.Count - 1
DoEvents
For Each ctl In Forms(i).Controls
DoEvents
If "FrmMIDmain" = Left(Forms(i).Caption, Len("FrmMIDmain")) Then
k = 1
frmName = "FrmMIDmain"
End If
If IsMissing(frmName) Then
If Forms(i).Caption = frmName Then
k = 1
End If
Else
l = 1
End If
If k = 1 Then
Set rs = mysql("tblver", "ver", strVer, "frm", frmName, "ctlName", Trim(ctl.Name))
Else
Set rs = mysql("tblver", "ver", strVer, "frm", Forms(i).Caption, "ctlName", Trim(ctl.Name))
End If
With rs
If k = 1 Or l = 1 Then
If rs.RecordCount = 1 Then
'If Trim(!ctlName) = Trim(ctl.Name) Then
ctl.Caption = !ctlCaption
' ctl.TabIndex = !ctlTabIndex
' ctl.ToopTiptext = !ctlToopTiptext
' ctl.Visible = !ctlVisible
' ctl.Enabled = !ctlEnabled
' ctl.Width = !ctlWidth
' ctl.Height = !ctlHeight
' ctl.Top = !ctltop
' ctl.Left = !ctlleft
End If
' .MoveNext
' Wend
.MoveFirst
End If
End With
Next
k = 0
Next
Set rs = Nothing
End Function
Public Function WriteControlInfo(ver As String, Optional frmName1 As String, Optional info As String)
'不传窗体名列举打开的所以窗体
'写入版本信息
'可以写入特定信息相关
On Error Resume Next
Dim rs2 As New ADODB.Recordset
Dim strFrmName
'!ctlType = ""
' End If
Dim i, n, k, l
Dim ctl As Control
Set rs2 = mysql(consttblVer)
For i = 0 To Forms.Count - 1
For Each ctl In Forms(i).Controls
With rs2
If IsMissing(frmName1) Then
If Forms(i).Caption = frmName1 Then
strFrmName = ctl.Name
k = 1
End If
Else
l = 1
End If
If k = 1 Or l = 1 Then '符合条件窗体
If TypeOf ctl Is TextBox Then
!ctlType = "TextBox"
n = 1
End If
If TypeOf ctl Is Label Then
!ctlType = "Label"
End If
If TypeOf ctl Is Form Then
strFrmName = ctl.Caption
!ctlType = "Form"
End If
If TypeOf ctl Is MDIForm Then
strFrmName = ctl.Name
!ctlType = "MDIForm"
End If
If TypeOf ctl Is ComboBox Then
!ctlType = "ComboBox"
n = 1
End If
If TypeOf ctl Is ListBox Then
!ctlType = "ListBox"
n = 1
End If
If TypeOf ctl Is CheckBox Then
!ctlType = "CheckBox"
End If
If TypeOf ctl Is CommandButton Then
!ctlType = "CommandButton"
End If
If TypeOf ctl Is OptionButton Then
!ctlType = "OptionButton"
End If
If TypeOf ctl Is Frame Then
!ctlType = "Frame"
End If
If TypeOf ctl Is Toolbar Then
!ctlType = "Toolbar"
End If
.AddNew
!frm = strFrmName
!ver = ver
!ctlName = ctl.Name
If n = 1 Then
!ctlCaption = ctl.Text
n = 0
Else
!ctlCaption = ctl.Caption
End If
If Not IsMissing(info) Then
!info = info
End If
!ctlEnabled = ctl.Enabled
!ctlTabIndex = ctl.TabIndex
!ctlToopTiptext = ctl.ToopTiptext
!ctlVisible = ctl.Visible
!ctlWidth = ctl.Width
!ctlHeight = ctl.Height
!ctltop = ctl.Top
!ctlleft = ctl.Left
!ver = ver
.Update
End If
End With
Next
Next
Set rs2 = Nothing
rs2.Close
End Function
'
'原创: 许仙; qq:19030300 主页:http://jjweb.126.com
'转载请保持信息的完整性 谢谢
'——————————————————————————————————
'将控件更改语言版本
'针对各个窗体读取控件信息写入控件信息
Public Function manageVer(strVer As String, Optional frmName As String)
'不传参数所以窗体全部改变版本
On Error Resume Next
Dim rs As New ADODB.Recordset
Dim i, k, ctl As Control, l
For i = 0 To Forms.Count - 1
DoEvents
For Each ctl In Forms(i).Controls
DoEvents
If "FrmMIDmain" = Left(Forms(i).Caption, Len("FrmMIDmain")) Then
k = 1
frmName = "FrmMIDmain"
End If
If IsMissing(frmName) Then
If Forms(i).Caption = frmName Then
k = 1
End If
Else
l = 1
End If
If k = 1 Then
Set rs = mysql("tblver", "ver", strVer, "frm", frmName, "ctlName", Trim(ctl.Name))
Else
Set rs = mysql("tblver", "ver", strVer, "frm", Forms(i).Caption, "ctlName", Trim(ctl.Name))
End If
With rs
If k = 1 Or l = 1 Then
If rs.RecordCount = 1 Then
'If Trim(!ctlName) = Trim(ctl.Name) Then
ctl.Caption = !ctlCaption
' ctl.TabIndex = !ctlTabIndex
' ctl.ToopTiptext = !ctlToopTiptext
' ctl.Visible = !ctlVisible
' ctl.Enabled = !ctlEnabled
' ctl.Width = !ctlWidth
' ctl.Height = !ctlHeight
' ctl.Top = !ctltop
' ctl.Left = !ctlleft
End If
' .MoveNext
' Wend
.MoveFirst
End If
End With
Next
k = 0
Next
Set rs = Nothing
End Function
Public Function WriteControlInfo(ver As String, Optional frmName1 As String, Optional info As String)
'不传窗体名列举打开的所以窗体
'写入版本信息
'可以写入特定信息相关
On Error Resume Next
Dim rs2 As New ADODB.Recordset
Dim strFrmName
'!ctlType = ""
' End If
Dim i, n, k, l
Dim ctl As Control
Set rs2 = mysql(consttblVer)
For i = 0 To Forms.Count - 1
For Each ctl In Forms(i).Controls
With rs2
If IsMissing(frmName1) Then
If Forms(i).Caption = frmName1 Then
strFrmName = ctl.Name
k = 1
End If
Else
l = 1
End If
If k = 1 Or l = 1 Then '符合条件窗体
If TypeOf ctl Is TextBox Then
!ctlType = "TextBox"
n = 1
End If
If TypeOf ctl Is Label Then
!ctlType = "Label"
End If
If TypeOf ctl Is Form Then
strFrmName = ctl.Caption
!ctlType = "Form"
End If
If TypeOf ctl Is MDIForm Then
strFrmName = ctl.Name
!ctlType = "MDIForm"
End If
If TypeOf ctl Is ComboBox Then
!ctlType = "ComboBox"
n = 1
End If
If TypeOf ctl Is ListBox Then
!ctlType = "ListBox"
n = 1
End If
If TypeOf ctl Is CheckBox Then
!ctlType = "CheckBox"
End If
If TypeOf ctl Is CommandButton Then
!ctlType = "CommandButton"
End If
If TypeOf ctl Is OptionButton Then
!ctlType = "OptionButton"
End If
If TypeOf ctl Is Frame Then
!ctlType = "Frame"
End If
If TypeOf ctl Is Toolbar Then
!ctlType = "Toolbar"
End If
.AddNew
!frm = strFrmName
!ver = ver
!ctlName = ctl.Name
If n = 1 Then
!ctlCaption = ctl.Text
n = 0
Else
!ctlCaption = ctl.Caption
End If
If Not IsMissing(info) Then
!info = info
End If
!ctlEnabled = ctl.Enabled
!ctlTabIndex = ctl.TabIndex
!ctlToopTiptext = ctl.ToopTiptext
!ctlVisible = ctl.Visible
!ctlWidth = ctl.Width
!ctlHeight = ctl.Height
!ctltop = ctl.Top
!ctlleft = ctl.Left
!ver = ver
.Update
End If
End With
Next
Next
Set rs2 = Nothing
rs2.Close
End Function
相关文章推荐
- 多语言程序在运行过程中,更改显示语言
- .net 4.0发布后不能正常显示图片问题,将iis应用程序池设置成4.0版本,报告错误:处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”
- Google Maps API V3学习【限制地图缩放级别和显示范围 包含V2版本程序】
- 中文版Windows Server 2012 R2更改为英文显示语言
- 程序中动态更改TextView显示内容并获取res的字符串
- 串口调试助手上输入数据0-9,然后再数码管显示(汇编语言版本)
- PERL语言入门:第四章:子程序(函数):习题1:写一个程序, 求所有参数的和
- 用JAVA语言编写程序:包含两个类,一个类Cricle中包含计算圆周长,面积的方法。在另一个类Compute中给出半径值为10,创建对象,并调用Cricle类中的方法,计算该对象的面积、周长并显示出结
- Java程序打包后图片不显示:Java的insertIcon函数打包后,路径问题
- node中"require"不是内部或外部命令,也不是可运行的程序 或批处理文件;express -V无法显示express版本信息等问题。
- C 语言main 函数终极探秘(&& 的含义是:如果 && 前面的程序正常退出,则继续执行 && 后面的程序,否则不执行)
- 怎样编写支持多国语言的程序, 让它能够根据所运行的操作系统自动显示相应的文字。
- 由例子程序给出的显示列表,展示重定形函数的应用
- 汇编语言: 编写一个程序,从键盘输入一个 0~65535 之间的 10 进制无符号数,然后以 16 进制 和四进制数形式显示出所输入的数。
- vs2008 MFC程序 读取显示图像、更改背景图像
- Firemonkey实现iOS程序运行时更改锁定显示方向(LockOrientations)
- 各种语言版本的程序样例集
- js函数模拟显示桌面.scf程序示例
- 几种不同程序语言的HMM版本
- 如何开发一个多种语言版本的C#程序