0

我正在尝试将几个框架连接在一起以实现网格类型排列:

在此处输入图像描述

在左侧,框架线有一个间隙。我怎样才能让这条线加入下面的框架?

4

2 回答 2

1

正如我对原始帖子的评论中所说,您可以通过仔细选择“带到前面”和“发送到后面”来解决这个问题....但是当您希望框架有一些标题时,这不起作用

在代码中,您可以使用 zorder 执行相同操作:

' 1 form with :
'    1 frame : name=Frame1    index=0
Option Explicit

Private Sub Form_Load()
  Dim intIndex As Integer
  Frame1(0).Caption = ""
  For intIndex = 1 To 8
    Load Frame1(intIndex)
    Frame1(intIndex).Visible = True
  Next intIndex
End Sub

Private Sub Form_Resize()
'  PlaceNormal
'  PlaceOverlap 0
  PlaceOverlap 1
End Sub

Private Sub PlaceNormal()
  Dim intRow As Integer, intCol As Integer
  Dim sngWidth As Single, sngHeight As Single
  sngWidth = ScaleWidth / 3
  sngHeight = ScaleHeight / 3
  For intRow = 0 To 2
    For intCol = 0 To 2
      Frame1(intRow * 3 + intCol).Move intCol * sngWidth, intRow * sngHeight, sngWidth, sngHeight
    Next intCol
  Next intRow
End Sub

Private Sub PlaceOverlap(intOrder As Integer)
  Dim intRow As Integer, intCol As Integer
  Dim sngWidth As Single, sngHeight As Single
  sngWidth = ScaleWidth / 3
  sngHeight = ScaleHeight / 3 + 120
  For intRow = 0 To 2
    For intCol = 0 To 2
      Frame1(intRow * 3 + intCol).Move intCol * sngWidth, intRow * (sngHeight - 120), sngWidth, sngHeight
      Frame1(intRow * 3 + intCol).ZOrder intOrder
    Next intCol
  Next intRow
End Sub

但同样:当框架需要有一些标题时,这不起作用

于 2012-11-21T09:49:37.933 回答
1

带有标签而不是框架标题的粗略示例

' 1 form with :
'    1 frame : name=Frame1    index=0
'    1 label in Frame1 : name=Label1    index=0
Option Explicit

Private Sub Form_Load()
  Dim intIndex As Integer
  Frame1(0).Caption = ""
  Label1(0).Caption = "0"
  Label1(0).Alignment = vbCenter
  For intIndex = 1 To 8
    Load Frame1(intIndex)
    Frame1(intIndex).Visible = True
    Load Label1(intIndex)
    Label1(intIndex).Visible = True
    Label1(intIndex).Caption = CStr(intIndex)
    Set Label1(intIndex).Container = Frame1(intIndex)
  Next intIndex
End Sub

Private Sub Form_Resize()
  PlaceOverlap 1
End Sub

Private Sub PlaceOverlap(intOrder As Integer)
  Dim intIndex As Integer
  Dim intRow As Integer, intCol As Integer
  Dim sngWidth As Single, sngHeight As Single
  sngWidth = ScaleWidth / 3
  sngHeight = ScaleHeight / 3 + 120
  For intRow = 0 To 2
    For intCol = 0 To 2
      intIndex = intRow * 3 + intCol
      With Frame1(intIndex)
        .Move intCol * sngWidth, intRow * (sngHeight - 120) - 120, sngWidth, sngHeight
        Label1(intIndex).Move 120, 120, .Width - 240, 195
        .ZOrder intOrder
      End With 'Frame1(intIndex)
    Next intCol
  Next intRow
End Sub
于 2012-11-21T12:33:17.403 回答