Line Control (VBCCRLine)
The VBCCRLine control is a control for drawing lines, which can create horizontal, vertical, or diagonal lines. It is commonly used for separating and decorating interface elements.
Properties
Key Properties
X1,Y1: Line start coordinatesX2,Y2: Line end coordinatesBorderColor: Line colorBorderStyle: Line style (solid, dashed, etc.)BorderWidth: Line widthVisible: Show/hide lineDrawMode: Drawing modeTag: User-defined data
Methods
Main Methods
Move(X1 As Single, Y1 As Single, X2 As Single, Y2 As Single): Move and adjust lineRefresh(): Refresh display
Events
Click(): Triggered when clickedDblClick(): Triggered when double-clickedMouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Code Examples
Basic Usage
vb
Private Sub Form_Load()
' Create horizontal separator
With Line1
.X1 = 0
.X2 = Me.ScaleWidth
.Y1 = 100
.Y2 = 100
.BorderColor = vbBlack
.BorderStyle = vbSolid
End With
End SubCreate Vertical Line
vb
Private Sub CreateVerticalLine()
With Line1
.X1 = 100
.X2 = 100
.Y1 = 0
.Y2 = Me.ScaleHeight
.BorderColor = RGB(200, 200, 200)
.BorderWidth = 1
End With
End SubDynamic Line Adjustment
vb
Private Sub ResizeLine()
' Adjust line with form
With Line1
.X1 = 0
.X2 = Me.ScaleWidth
.Y1 = 50
.Y2 = 50
End With
End Sub
Private Sub Form_Resize()
ResizeLine
End SubCommon Use Cases
Group Separator
vb
Private Sub CreateGroupSeparator()
' Create separator between groups
With Line1
.X1 = Frame1.Left
.X2 = Frame1.Left + Frame1.Width
.Y1 = Frame1.Top + Frame1.Height + 5
.Y2 = .Y1
.BorderStyle = vbSolid
.BorderColor = RGB(200, 200, 200)
End With
End Sub