05-18-2006, 05:14 PM
Take how many pixels your screen is wide
divide by 2 for center
then divide by 8 for CHAR spaces to center
then take yout string and divide by 2
minus that from your screen center!
then plug you final number in to LOCATE X,Y
eg
TEXT$="HELLO WORLD!" <----- string length is 12
screen length=640
640/2=320
320/8=40 <--- screen center for TEXT
12/2=6 <------ Text center
40-6=34 <--- text start for centered text!
LOCATE 34,1RINT TEXT$ <------ it is now centered!
if you want just a comanded you would either have to write one
or look for a library.
divide by 2 for center
then divide by 8 for CHAR spaces to center
then take yout string and divide by 2
minus that from your screen center!
then plug you final number in to LOCATE X,Y
eg
TEXT$="HELLO WORLD!" <----- string length is 12
screen length=640
640/2=320
320/8=40 <--- screen center for TEXT
12/2=6 <------ Text center
40-6=34 <--- text start for centered text!
LOCATE 34,1RINT TEXT$ <------ it is now centered!
if you want just a comanded you would either have to write one
or look for a library.