Private Function LoadBmpMenuLines(Legnth As Integer, ColorPallet As String, X As Integer, Y As Integer, Optional Gray As Boolean = True, Optional Brightness As Integer = 0) As Integer
If ColorPallet = "" Then Exit Function
Dim PixCount
Dim Colors() As String, CurrentRow, CurrentColumn, Count, Rows
Colors = Split(ColorPallet, ",")
Rows = Int(Split(ColorPallet, ",")(0))
For Count = 1 To UBound(Colors)
If CurrentRow > (Rows) Then CurrentRow = 0: CurrentColumn = CurrentColumn + 1
If Colors(Count) <> -1 Then
If Gray = True Then
Picture1.Line (X + CurrentColumn, Y + CurrentRow)-(X + CurrentColumn + Legnth, Y + CurrentRow), AdjustBrightness(Colors(Count), Brightness)
Else
Picture1.Line (X + CurrentColumn, Y + CurrentRow)-(X + CurrentColumn + Legnth, Y + CurrentRow), MakeGrey(Colors(Count))