Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a custom dotted line?

Graphical Techniques in QB

How do I make a custom dotted line?

by  qbasicking  Posted    (Edited  )
Most people know how to make a broken line using &H5555 and &H2222, but say you want a line that is an oddball and you don't know the code for it. Do you have to use trial and error, not any more.

The last number is figured out in binary, and it goes in loops of 15; here is a chart that will help you

16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1


so say you want a line that goes 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1

figure out it out by plugging it into the table and adding all the values together

16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1
0 1 1 0 1 0 0 1 1 0 0 1 0 1 1

Now add up all the numbers that had a 1 under them
8192+4096+1024+128+64+8+2+1=13515

LINE (100,100)-(200,100),,,13515





Here is a FUNCTION to help you in your programming, so now you can use

a$ = "011010011001011"
LINE (100,100)-(200,100),,,Bin2Dec%(a$)

FUNCTION Bin2Dec% (number$)
place = 65535 / 2
FOR a% = 1 TO 16
c$ = MID$(number$, a%, 1)
IF c$ = "1" THEN num% = num% + place
place = place / 2
NEXT
Bin2Dec% = num%
END FUNCTION
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top