so...... das ganze ist jetzt zwar auf mein Beispiel zugeschnitten und ohne MDI aber ich denke du wirst dich zurecht finden und dir den Code auf deine Bedürfnisse anpassen können. Sorry für meine Faulheit
Modul:
Public gWidth As Integer, gHeight As Integer
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Sub SystemMetrics(ByRef MaxWidth As Integer, ByRef MaxHeight As Integer)
MaxWidth = GetSystemMetrics(SM_CXSCREEN)
MaxHeight = GetSystemMetrics(SM_CYSCREEN)
End Sub
Public Sub Screen_Value()
SystemMetrics gWidth, gHeight
End Sub
Public Function ReturnMetrics(ByVal nIndex As Long) As Long
ReturnMetrics = GetSystemMetrics(nIndex)
End Function Form-Code:
Dim nTop(15, 1) As Integer, nLeft(15, 1) As Integer
Dim nHeight(15, 1) As Integer, nWidth(15, 1) As Integer
Private Sub Form_Load()
Dim i As Integer
Dim b As Integer
Screen_Value
For i = 0 To 15
Set Label1(i).Container = frmCustomers 'Frame1
nTop(i, 0) = Label1(i).Top
nLeft(i, 0) = Label1(i).Left
nHeight(i, 0) = Label1(i).Height
nWidth(i, 0) = Label1(i).Width
Set Text1(i).Container = frmCustomers 'Frame1
nTop(i, 1) = Text1(i).Top
nLeft(i, 1) = Text1(i).Left
nHeight(i, 1) = Text1(i).Height
nWidth(i, 1) = Text1(i).Width
Next
For b = 0 To 2
Set Command(b).Container = frmCustomers 'Frame1
nTop(b, 0) = Command(b).Top
nLeft(b, 0) = Command(b).Left
nHeight(b, 0) = Command(b).Height
nWidth(b, 0) = Command(b).Width
Next
End Sub
Private Sub Form_Resize()
Dim HeightVal As Integer, XMultiplier As Single, YMultiplier As Single
XMultiplier = ReturnMetrics(SM_CXSCREEN) / gWidth
YMultiplier = ReturnMetrics(SM_CYSCREEN) / gHeight
On Error Resume Next
If Me.Height < 5430 Then Me.Height = 5430
If Me.Width < 6660 Then Me.Width = 6660
If gWidth = 800 And gHeight = 600 Then HeightVal = (frmCustomers.Height - _
4000) \ 16
If gWidth = 1024 And gHeight = 768 Then HeightVal = (frmCustomers.Height - _
6000) \ 16
If gWidth = 1280 And gHeight = 1024 Then HeightVal = (frmCustomers.Height - _
8000) \ 16
For i = 0 To 15
Text1(i).Width = (frmCustomers.Width - 550 - nLeft(i, 1)) * XMultiplier
Text1(i).Height = (HeightVal - 305) * YMultiplier
Text1(i).Top = (240 + HeightVal * i) * YMultiplier
Label1(i).Height = (HeightVal - 105) * YMultiplier
Label1(i).Top = (240 + HeightVal * i) * YMultiplier
Next
For b = 0 To 2
Command(b).Height = (Command(b).Height) * YMultiplier
Command(b).Top = (HeightVal) * 20
Command(b).Left = (240 + 3000 * b) * XMultiplier
Next
End Sub |