Hallo Okruegel,
dein Problem mit der Positionierung der Labels kann ich
nicht nachvollziehen. Steht eventuell Autosize auf True?
Du kannst alles mit einem einzigen Label-Array darstellen.
Ideal wäre ja ein 2D-Control-Array, dann könnte die eine
Dimension die Bahn enthalten und die andere Dimension
die Zeit. Control-Arrays sind aber immer 1D. Man kann
aber jedes 1D-Array in ein 2D-Array umrechnen und
umgekehrt. Du könntest daher ein 2D-UDT-Array anlegen
und darin zu jeder Bahn + Zeit den Index des dazugehörigen
Labels ablegen. Dann kann man vom Index auf die Bahn
schliessen als auch über das UDT-Array auf die Labels
zurückgreifen, um z.B. alle Labels einer Bahn zu löschen.
Eine Alternative wäre vielleicht noch das Flexgrid:
' Controls: 1 * MSFlexGrid
Private Sub Form_Load()
Dim i&, j&, Zeit&, Von&, Bis&
Zeit = 0
Randomize
With MSFlexGrid1
.Redraw = False
.BackColor = RGB(200, 200, 255)
.Rows = 74
.Cols = 16
.HighLight = flexHighlightNever
.FixedRows = 2
.FixedCols = 1
.ScrollBars = flexScrollBarBoth
.ScrollTrack = True
.BackColorFixed = RGB(36, 53, 81)
.ForeColorFixed = RGB(212, 212, 223)
.GridColor = RGB(90, 96, 132)
.MergeCells = flexMergeRestrictColumns
.MergeRow(0) = True
.MergeCol(0) = True
For i = .FixedRows To .Rows - 1
.Row = i
.Col = 0
.CellFontSize = 12
.Text = CStr(Zeit) & ":00"
If ((i - .FixedRows) And 1) = 1 Then Zeit = (Zeit + 1) Mod 24
Next i
For i = 1 To .Cols - 1
.TextArray(i) = WeekdayName(3)
.Row = 0
.Col = i
.CellBackColor = RGB(192, 192, 208)
.CellForeColor = RGB(85, 61, 69)
.CellAlignment = flexAlignCenterCenter
.Row = 1
.Col = i
.CellBackColor = RGB(192, 192, 208)
.CellForeColor = RGB(85, 61, 69)
.CellAlignment = flexAlignCenterCenter
.Text = "Bahn" & Str(i)
Next i
For i = .FixedCols To .Cols - 1
Von = .FixedRows + Int(Rnd * 24)
Bis = Von + Int(Rnd * 20)
.TextMatrix(Von, i) = "Spieler" & Str(i)
.Row = Von
.Col = i
.CellForeColor = RGB(200, 200, 200)
.RowSel = Bis
.ColSel = i
.FillStyle = flexFillRepeat
.CellBackColor = QBColor(1 + (1 + i) Mod 15)
.FillStyle = flexFillSingle
Next i
.Row = .FixedRows
.Col = .FixedCols
.ZOrder vbBringToFront
.Redraw = True
End With
End Sub Gruss,
Zardoz |