Re: Größe eines Frames dynamisch gestaltbar?
23.01.2003 13:21:51
Steffan
Hallo Martin,automatisch geht es m.E. nicht.
Aber vielleicht probierst Du mal folgenden Ansatz (der Code sollte dem combobox_Change-Ereignis zugeordnet werden, die Textboxen sollten TextBox1, TextBox2, TextBox.., etc. heißen.)
'Startpos aus Position von Textbox1 ermitteln
'WICHTIG: Textbox1 muss oben stehen
iStartPos = TextBox1.Top
'Abstand aus Abstand von Textbox1 und Textbox2 ermitteln
'WICHTIG: Textbox2 muss direkt unter Textbox1 stehen
iAbstand = TextBox2.Top - TextBox1.Top
'unteren Rand festlegen
iRand = 10
iAktStart = iStartPos
For i = 0 To UserForm1.Controls.Count - 1
If InStr(1, LCase(Controls(i).Name), "textbox") = 1 Then
If Not (Controls(i).Text = "") Then
Controls(i).Visible = True
Controls(i).Top = iAktStart
iAktStart = iAktStart + iAbstand
Else
Controls(i).Visible = False
End If
Else
If iMaxPos < Controls(i).Top + Controls(i).Height + iRand Then _
iMaxPos = Controls(i).Top + Controls(i).Height + iRand
End If
Next i
UserForm1.Height = UserForm1.Height - UserForm1.InsideHeight + iMaxPos
Code eingefügt mit Syntaxhighlighter 1.16
Steffan.