Small Basic – How to change the thickness and color of your lines


First of all, drop in this code to draw a line:

 

GraphicsWindow.Title    = “Line Time”

GraphicsWindow.DrawLine(10,70,130,70)

 

If you want to change the thickness or color of the line, use the PenWidth and PenColor properties of the GraphicsWindow object. For example, to draw with a thicker, green pen, update your program like this:

 

GraphicsWindow.Title    = “Lime Time”

GraphicsWindow.PenWidth = 3        ‘Try different numbers

GraphicsWindow.PenColor = “Green”  ‘Try different colors

GraphicsWindow.DrawLine(10,70,130,70)

‘Continue your program

     

After you make that change, run your program again to see what’s different. Now experiment with some colors and different pen widths!

All the colors are listed here:

Small Basic Getting Started Guide: Appendix B: Colors

 

Have a Small and Basic week!

   – User Ed & Majed Marji

Comments (1)

  1. Computers Today (part 1 of 6)

    blogs.msdn.com/…/computers-today.aspx

    …..

    CS SPOTLIGHT: Girls in computer programming… why it matters!!!

    blogs.msdn.com/…/cs-spotlight-girls-in-computer-programming-why-it-matters.aspx

    Computational Thinking – Videos & Papers by Jeannette Wing

    blogs.msdn.com/…/computational-thinking-videos-amp-papers-by-jeannette-wing.aspx

Skip to main content