Access 控件自适应分辨率
时 间:2019-11-25 18:15:14
作 者:蒋东林 ID:72854 城市:重庆
摘 要:access 控件自适应 vba代码
原作者:loooooo
修改: auqaiss
正 文:
原作者:loooooo
修改: auqaiss
Option Compare Database
Type JLtype '????????????
Tn As String '?????
T1 As Integer '?????????
L1 As Integer '?????????
W1 As Integer '??????
H1 As Integer '??????
End Type
Type CTS '????????????
Cn As String '??????
OLDW As Integer '????????
OLDH As Integer '????????
TZzz() As JLtype '????????????????
i As Integer '?????????????????
End Type
Public CC() As CTS '???????????飨??????????????????棩
Public Sub TZLoad(Frm As Form)
'--------------------------
On Error GoTo cuowu1
Dim Cw As Long '??鴰????±???????δ???????
Cw = UBound(CC)
'----------------------------
'On Error GoTo cuowu
Dim N As String
Dim JJ As Integer
Dim PD As Boolean
'?????????????壬??????????????
N = Frm.name
For JJ = LBound(CC) To UBound(CC)
If CC(JJ).Cn = N Then
PD = True
Exit For
Else
PD = False
End If
Next JJ
If PD = False Then
JJ = JJ + 1
ReDim Preserve CC(JJ)
End If
JJ = JJ + 1
ReDim Preserve CC(JJ)
End If
'????????????????????????????????????
CC(JJ).Cn = N
CC(JJ).OLDH = Frm.InsideHeight
CC(JJ).OLDW = Frm.InsideWidth
CC(JJ).i = 0 '????????????????
Dim obj As Control
Dim L As Integer
Dim L As Integer
For Each obj In Frm
CC(JJ).i = CC(JJ).i + 1
L = CC(JJ).i
ReDim Preserve CC(JJ).TZzz(L)
CC(JJ).TZzz(L).Tn = obj.name
CC(JJ).TZzz(L).T1 = obj.Top
CC(JJ).TZzz(L).L1 = obj.Left
CC(JJ).TZzz(L).W1 = obj.Width
CC(JJ).TZzz(L).H1 = obj.Height
Next obj
CC(JJ).i = CC(JJ).i + 1
L = CC(JJ).i
ReDim Preserve CC(JJ).TZzz(L)
CC(JJ).TZzz(L).Tn = obj.name
CC(JJ).TZzz(L).T1 = obj.Top
CC(JJ).TZzz(L).L1 = obj.Left
CC(JJ).TZzz(L).W1 = obj.Width
CC(JJ).TZzz(L).H1 = obj.Height
Next obj
Exit Sub
cuowu1:
ReDim CC(1)
Resume Next
ReDim CC(1)
Resume Next
cuowu:
MsgBox Err.Description
Exit Sub
MsgBox Err.Description
Exit Sub
End Sub
Public Sub TZsize(Frmt As Form)
'On Error GoTo cuowu
Dim N As String
Dim X As Double
Dim Y As Double
Dim j As Integer
Dim JJ As Integer
Dim X As Double
Dim Y As Double
Dim j As Integer
Dim JJ As Integer
N = Frmt.name
For JJ = LBound(CC) To UBound(CC)
If CC(JJ).Cn = N Then Exit For
Next JJ
If CC(JJ).Cn = N Then Exit For
Next JJ
Dim obj As Control
Y = Frmt.InsideHeight / CC(JJ).OLDH
X = Frmt.InsideWidth / CC(JJ).OLDW
X = Frmt.InsideWidth / CC(JJ).OLDW
Frmt.Section(acDetail).Height = Frmt.InsideHeight '????????,?????????
For j = 1 To CC(JJ).i
Set obj = Frmt(CC(JJ).TZzz(j).Tn)
'if obj.Name="
With obj
If Len(.name) < 16 or Left(.name, 16) <> "NavigationButton" Then '原来作者这里没有判断是否是NavigationButton,导致一旦对其.top .left属性赋值就会报错
.Top = CC(JJ).TZzz(j).T1 * 1.1
.Left = CC(JJ).TZzz(j).L1 * X
End If
.Width = CC(JJ).TZzz(j).W1 * X
.Height = CC(JJ).TZzz(j).H1 * Y
End With
Next j
Set obj = Frmt(CC(JJ).TZzz(j).Tn)
'if obj.Name="
With obj
If Len(.name) < 16 or Left(.name, 16) <> "NavigationButton" Then '原来作者这里没有判断是否是NavigationButton,导致一旦对其.top .left属性赋值就会报错
.Top = CC(JJ).TZzz(j).T1 * 1.1
.Left = CC(JJ).TZzz(j).L1 * X
End If
.Width = CC(JJ).TZzz(j).W1 * X
.Height = CC(JJ).TZzz(j).H1 * Y
End With
Next j
Exit Sub
cuowu:
MsgBox Err.Description
Exit Sub
MsgBox Err.Description
Exit Sub
End Sub
Access软件网QQ交流群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access对子窗体数据进行批...(10.30)
- 最精简的组合框行来源数据快速输...(10.25)
- Access仿平台的多值选择器...(10.24)
- 【Access日期区间段查询】...(10.22)
- 【Access源码示例】VBA...(10.12)
- Access累乘示例,Acce...(10.09)
- 数值8.88,把整数8去掉,转...(10.08)
- 【Access自定义函数】一个...(09.30)
- 【Access选项卡示例】Ac...(09.09)
学习心得
最新文章
- Access快速开发平台--对上传...(11.22)
- Access快速开发平台企业版--...(11.18)
- 不会用多表联合查询,多表查询没结果...(11.16)
- 【案例分享】主键字段值含有不间断空...(11.16)
- Access快速开发平台--后台D...(11.14)
- 微软Access邀测新Monaco...(11.12)
- Access列表框左右互选、列表框...(11.11)
- 高效率在导入数据前删除记录(11.10)
- Access报价单转订单示例代码(11.08)
- Access系统自带的日期选择器不...(11.08)