Results 1 to 16 of 16

Thread: Using Line (I cant work out where i have gone wrong)

  1. #1

    Thread Starter
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935

    Using Line (I cant work out where i have gone wrong)

    Hi chaps me again !!!

    im trying to draw a line around the edge of a picture box

    my code seems fine it doesnt gereate any errors but i dont get a line either can someone check my math is right ??

    ps i have tried setting the scalemodes to pixel as well as twipsperpixel

    this example is in twips where 6 twips = pixel

    VB Code:
    1. Private Sub Form_Load()
    2. frm1.ScaleMode = 1
    3. pic1.ScaleMode = 1
    4. drawbox
    5. End Sub
    6.  
    7. Public Sub drawbox()
    8. Dim LTop As Integer
    9. Dim LBottom As Integer
    10. Dim Lleft As Integer
    11. Dim LRight As Integer
    12.  
    13. pic1.Cls
    14.  
    15. LTop = pic1.Top + 6
    16. LBottom = pic1.Top + pic1.Height - 6
    17. Lleft = pic1.Left + 6
    18. LRight = pic1.Left + pic1.Width - 6
    19.  
    20. pic1.DrawWidth = 6
    21.  
    22. pic1.Line (Lleft, LBottom)-(LRight, LBottom), RGB(127, 157, 185)
    23. pic1.Line (LRight, LBottom)-(LRight, LTop), RGB(127, 157, 185)
    24.  
    25. End Sub

    any Ideas people??

  2. #2

    Thread Starter
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    Never mind i found out where i went wrong lol

    I forgot to ake the picture box Autoredraw property to True

    DOH


  3. #3
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Eh, you should use

    0 for left and top

    and

    scalewidth instead of left + width

    and

    scaleheight instead of top + height
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Doesn't a line have to be given 4 points?

    I don't think you've passed 4 points to it...

  5. #5
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    ??

    pic1.Line (0, 0)-(pic1.ScaleWidth - 15, pic1.ScaleHeight - 15), , B

    seems u do alot for little... ?
    -= a peet post =-

  6. #6
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Originally posted by da_silvy
    Doesn't a line have to be given 4 points?

    I don't think you've passed 4 points to it...
    Who is this to?

    OK #1 you pass 2 points ( a line is defined by 2 points in case you haven't taken algebra 1 yet )

    And both rudvs2's code and mine passes 2 points.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  7. #7
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    i think he was referring to a rectangle having 4 lines. Rud's code only had 2 (bottom and right). But anyway, Peeeeeeet is the scandi god and is right that a B (for box) line method is much easier (or even a shape control).
    rud's whut yuh dun mut, yuh furgut huh tuh pruhgrumm??
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  8. #8
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Originally posted by mlewis


    Who is this to?

    OK #1 you pass 2 points ( a line is defined by 2 points in case you haven't taken algebra 1 yet )

    And both rudvs2's code and mine passes 2 points.
    OK FINE

    You wanna go me? Bring it

    To put a line on the screen
    you need four values

    X1, Y1, X1, Y2

    I've done Algebra

    I'm on a scholarship to my school

    I've got full marks on 6 out of the last 7 maths tests...

    And I'm probably going to do Year 11 maths next year (although i'll be in year 10)

    Anything else you want to know?

    I'm not a dumb ass you tool
    Last edited by da_silvy; Nov 16th, 2001 at 10:16 PM.

  9. #9
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Settle down there tiger!!!

    1...2...3...4....5........
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  10. #10
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Well he keeps on having cracks at me.

    i'm really starting to get quite pi$$ed off too

  11. #11
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Jeez da_silvy...calm down and quit taking everything so personally.

    Although you have the right to your opinion, and you are allowed to say that you dislike me, please do not do so in your signature.


    You are perfectly correct that a line needs X1, Y1, X2, Y2; I agree.

    However: (X1, Y1) is one point, and (X2, Y2) is the second.

    Therefore you need 4 values, but 2 points.


    None of this is intended to flame you, "have cracks" at you, or anything of the kind. These forums are here so people can share the knowledge and experience they have with others. Its OK to be wrong; I've been wrong many more times than most people I know, probably including you. If you don't make mistakes, you can't learn from them, right?

    Don't take this so hard, and please don't be so antagonistic, or treat me like I am trying to cut you down. This is not my intent.

    This is the second time I've had to do this; let's not have it happen a third time OK?

    :: offers to shake hands, shutup, and never bug you again (well, maybe I'll bug you again in a looooong time ) ::
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  12. #12
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    OK then

    Thats alright

    I meant to say values before.

    Truce now

  13. #13
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Truce...*whew*


    Nice signature btw
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  14. #14
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527



    Sorry man -
    I haven't had much sleep lately

  15. #15
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    I haven't eitherhrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrr

    HUh?!?? What?!? oh, oops sorry...fell asleep at the keys again.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  16. #16
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    heheheh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width