Greyscale bars/Display: Difference between revisions

Content added Content deleted
No edit summary
Line 509: Line 509:
}
}
</lang>
</lang>

=={{header|Gambas}}==
<lang gambas>Public Sub Form_Open()
Dim iRow, iCol, iClr As Integer 'For Row, Column and Colour
Dim iInc As Integer = 4 'To calculate RGB colour
Dim h1Panel As Panel 'Panels to display colours

With Me 'Setup the Form
.Arrangement = Arrange.Row 'Arrange children in rows
.Border = False 'No Border
.Height = Desktop.Height 'Fill the screen
.Width = Desktop.Width 'Fill the screen
.Fullscreen = True 'Set the Form to Fullscreen
End With

For iRow = 1 To 4 'For each row..
iInc += iInc 'Increase iInc by itself
For iCol = 0 To iInc - 1 'For each column..
iClr = iCol * (256 / iInc) 'Set the RGB colour
If iRow = 2 Or iRow = 4 Then iClr = 255 - (iCol * (256 / iInc)) 'If row 2 or 4 then reverse the colours
h1Panel = New Panel(Me) 'Create a new Panel
With h1Panel 'With the Panel..
.Width = Desktop.Width / iInc 'Set the width
.Height = Desktop.Height / 4 'Set the height
.Background = Color.RGB(iClr, iClr, iClr) 'Set the Background colour
.Border = Border.Plain 'Set a Border (It's easier to see the colour changes)
End With
Next
Next

End</lang>

'''[http://www.cogier.com/gambas/GreyScale.png Click here for image of the output]'''


=={{header|Haskell}}==
=={{header|Haskell}}==