Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Graphical Techniques in QB

How do I make a custom dotted line?
Posted: 15 Sep 02 (Edited 1 Sep 03)

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

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
Bin2Dec% = num%

Back to QBasic FAQ Index
Back to QBasic Forum

My Archive


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close