Load Picture1(Picture1.UBound + 1)
Load Label1(Label1.UBound + 1)
Load sock(sock.UBound + 1)
SockIndex = Label1.UBound
SockIndex = Picture1.UBound
SockIndex = sock.UBound
Picture1(Picture1.UBound).Visible = True
Picture1(Picture1.UBound).Left = i * 3000
Label1(Label1.UBound).Visible = True
Label1(Label1.UBound).Left = i * 3000
Load 後,SockIndex 被連續指派三次,最終等於 sock.UBound。若三個陣列原始上界不同,導致後續 Picture1(SockIndex)、Label1(SockIndex) 索引錯誤。
picIdx = Picture1.UBound、lblIdx = Label1.UBound、sockIdx = sock.UBound,後續分別使用對應索引。Label1(lblIdx).AutoSize = True 或明確指定 .Width、.Height。Caption 指派在 Visible=True 之後。Label1(lblIdx).ZOrder vbBringToFront。Label1(lblIdx).Container = Picture1(picIdx)(VB6 不支援動態容器變更,建議同層級)。Microsoft Windows Common Controls 版本一致,避免控制項載入失敗靜默失效。Load 後立即用 Debug.Print Label1(Label1.UBound).Left, .Top, .Width, .Height, .Visible, .ZOrder 輸出屬性。「label 也是可以的,看下寬度、zindex 順序。調試下就知道了。」