How to resolve the algorithm Colour pinstripe/Display step by step in the Gambas programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Colour pinstripe/Display step by step in the Gambas programming language

Table of Contents

Problem Statement

The task is to create 1 pixel wide coloured vertical pinstripes with a sufficient number of pinstripes to span the entire width of the graphics display.

The pinstripes should either follow the system palette sequence,   or a sequence that includes: black,   red,   green,   blue,   magenta,   cyan,   yellow,   and   white:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Colour pinstripe/Display step by step in the Gambas programming language

Source code in the gambas programming language

'WARNING this takes a time to display

Public Sub Form_Open()
Dim iColour As Integer[] = [Color.Black, Color.red, Color.Green, Color.Magenta, Color.Cyan, Color.Yellow, Color.white]
Dim hPanel As Panel
Dim siCount, siCounter, siSet As Short

With Me
  .Arrangement = Arrange.Row
  .Border = False
  .Height = 1080
  .Width = 400
  .Fullscreen = True
End With

For siCounter = 1 To 4 
  For siCount = 0 To Desktop.Width Step siCounter
    hpanel = New Panel(Me)
    hpanel.Width = siCounter
    hpanel.Height = Desktop.Height / 4
    HPanel.Background = iColour[siSet]
    Inc siSet
    If siSet > 6 Then siSet = 0
  Next
Next

End

  

You may also check:How to resolve the algorithm Mutual recursion step by step in the Kotlin programming language
You may also check:How to resolve the algorithm General FizzBuzz step by step in the Ursa programming language
You may also check:How to resolve the algorithm Sort an array of composite structures step by step in the NetRexx programming language
You may also check:How to resolve the algorithm Execute a system command step by step in the gnuplot programming language
You may also check:How to resolve the algorithm Deal cards for FreeCell step by step in the OCaml programming language