Attribute VB_Name = "LineDemoModule" Option Explicit '--------------------------------------------------------- 'Line Demo 'Use of the WS_LINE widget '--------------------------------------------------------- Public wsFactory As New WStFactory Public wsForm As New WStForm Public wsWidget As New WStWidget Public Sub Main() Dim bResult As Boolean Dim sObjectName As String Dim bEnd As Boolean Dim iRed As Integer Dim iGreen As Integer Dim iBlue As Integer Dim i As Integer Dim iWidth As Integer Dim bHorizontal As Boolean Randomize iRed = Int((255 + 1) * Rnd) iGreen = Int((255 + 1) * Rnd) iBlue = Int((255 + 1) * Rnd) i = 0 iWidth = 3 bHorizontal = True bEnd = False 'Form creation and customization wsFactory.CreateFormByName "myForm" wsForm.SetCoordTypeByName "myForm", WS_FORM_CT_BYPERCENTAGE 'Widgets creation wsFactory.CreateWidget WS_LABEL, 0, "formTittle", 35, 0, 40, 5, "Line Demo" wsFactory.CreateWidget WS_LINE, 0, "line", 5, 10, 90, 60, "" 'Widgets attachment wsForm.AddObjectByName "myForm", "formTittle" wsForm.AddObjectByName "myForm", "line" 'Widgets customization wsWidget.SetTextColorByName "line", iRed, iGreen, iBlue wsWidget.SetLineWidthByName "line", iWidth If wsForm.ShowByName("myForm", True, True) <> True Then Exit Sub End If bEnd = False bResult = True 'On each iteration the color and the width of the line is modified, 'and its also rotated While (bEnd = False And bResult) iRed = Int((255 + 1) * Rnd) iGreen = Int((255 + 1) * Rnd) iBlue = Int((255 + 1) * Rnd) wsWidget.SetTextColorByName "line", iRed, iGreen, iBlue If bHorizontal Then wsWidget.SetOrientationByName "line", WS_ORIENTATION_HORIZ Else wsWidget.SetOrientationByName "line", WS_ORIENTATION_VERT End If bHorizontal = Not bHorizontal iWidth = Int((15 - 1 + 1) * Rnd + 1) wsWidget.SetLineWidthByName "line", iWidth bResult = wsForm.CommitChangesByName("myForm") If i = 50 Then bEnd = True End If i = i + 1 Wend End Sub