Main Site Documentation

I need a little help shortening the following vb code


#1

hi, i was wondering if you could help me, i have tried to shorten this code:

        Draw_Rectangle(4 + c_Hour, 70, 4 + c_Hour + 2, 90, GT.Color.FromRGB(50, 50, 255))
        Draw_Rectangle(6 + c_Hour, 71, 6 + c_Hour + 1, 89, GT.Color.FromRGB(50, 50, 255))
        Draw_Rectangle(7 + c_Hour, 72, 7 + c_Hour + 1, 88, GT.Color.FromRGB(50, 50, 255))
        Draw_Rectangle(8 + c_Hour, 73, 8 + c_Hour + 1, 87, GT.Color.FromRGB(50, 50, 255))
        Draw_Rectangle(9 + c_Hour, 74, 9 + c_Hour + 1, 86, GT.Color.FromRGB(50, 50, 255))
        Draw_Rectangle(10 + c_Hour, 75, 10 + c_Hour + 1, 85, GT.Color.FromRGB(50, 50, 255))
        Draw_Rectangle(11 + c_Hour, 76, 11 + c_Hour + 1, 84, GT.Color.FromRGB(50, 50, 255))
        Draw_Rectangle(12 + c_Hour, 77, 12 + c_Hour + 1, 83, GT.Color.FromRGB(50, 50, 255))
        Draw_Rectangle(13 + c_Hour, 78, 13 + c_Hour + 1, 82, GT.Color.FromRGB(50, 50, 255))
        Draw_Rectangle(14 + c_Hour, 79, 14 + c_Hour + 1, 81, GT.Color.FromRGB(50, 50, 255))

by declaring the following and using the following code:

        'If increasing <> decreasing Then
        
        'Draw_Rectangle(x_start + c_Hour, increasing, x_start + c_Hour + 1, decreasing, GT.Color.FromRGB(250, 0, 250))
        'increasing = +1
        'decreasing = -1
        'x_start = +1
        'End If

it doesn’t work and i cant work out why.

this will be very simple for some of you. please help if you can. The aim is to use single pixel rectangles to make an arrow the c-hour is pulling numbers from the timer to shift the arrow along, the first code works.