Oh boy! I haven't implemented one of those in what...twenty years?
There are a lot of ways to do it: some simple, and some much, much better. Wiki has a list:
http://en.wikipedia.org/wiki/Line_drawing_algorithm[
^] - pick one you like and off you go!
(But don't expect them to look as good as the standard Windows line drawing functions unless you put in a lot of work. Look up antialiasing while you are at it.)