Results 1 to 11 of 11

Thread: stupid graphics.drawrectangle

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    stupid graphics.drawrectangle

    this is stupid.
    VB Code:
    1. gr.DrawRectangle(Pens.Red, New Rectangle(0, 0, 100, 100))

    New Rectangle(0, 0, 100, 100)
    this is supposed to make a rectangle with size 100x100 located at 0,0
    Well when you try to DRAW that, it will draw a rectangle of size 101x101. STUPID!!!!
    I had a similar problem with the drawing classes before, but I think it was about something else. I just wanna kill the VS developers. Why do they make so many stupid "mistakes"?!!!!
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    framework developers...not VS devolpers :P
    \m/\m/

  3. #3
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176
    I am so glad you could help him


    Hmm wait a minute this doesnt help either!!!!!!!1

    AHHHH I AM GOING MAD!!!!!!!!!!!!!!!!


    MERRY CHRISTMAS (If you care)
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    aaah whatever
    Jerry christmas (merry I mean, just a typo )
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5
    New Member
    Join Date
    Nov 2002
    Posts
    15

    Yup.

    It draws the rectangle at a size of 101 x 101 simply because...

    100 through 0 is 101 pixels. Simply, count from 1 to 100. The count is 100. Now count from 0 to 100. The count is 101. Easy enough?

    <vbcode>
    If 100 is your rectangle size, use that as a constant. Then refer to that as intRectWidth. To use that in code, use

    dim myRect as new Rectangle(0,0,intRectWidth - 1,intRectHeight - 1)
    </vbcode>

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Yup.

    Originally posted by NomadtheGrey
    It draws the rectangle at a size of 101 x 101 simply because...

    100 through 0 is 101 pixels. Simply, count from 1 to 100. The count is 100. Now count from 0 to 100. The count is 101. Easy enough?

    <vbcode>
    If 100 is your rectangle size, use that as a constant. Then refer to that as intRectWidth. To use that in code, use

    dim myRect as new Rectangle(0,0,intRectWidth - 1,intRectHeight - 1)
    </vbcode>
    dude, I'm not that dumb!!!
    first of all when you create a rectangle, the 3rd and the 4th parameters are WIDTH and HEIGHT, and not what you say.
    second, if you choose a pen width greater than 1 pixels, it works fine. So if you try to draw a 100x100 rectangle with my code, with a pen width of 2 pixels, it will actually draw it by that size
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401
    LMAO@
    dude, I'm not that dumb!!!
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  8. #8
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Re: stupid graphics.drawrectangle

    Originally posted by MrPolite
    this is stupid.
    VB Code:
    1. gr.DrawRectangle(Pens.Red, New Rectangle(0, 0, 100, 100))

    New Rectangle(0, 0, 100, 100)
    this is supposed to make a rectangle with size 100x100 located at 0,0
    Well when you try to DRAW that, it will draw a rectangle of size 101x101. STUPID!!!!
    I had a similar problem with the drawing classes before, but I think it was about something else. I just wanna kill the VS developers. Why do they make so many stupid "mistakes"?!!!!
    Ok, I am going out on a limb here...don't shoot me if I am off target.
    You say that when you create a 100 X 100 rect with a 1 wide pixle pen, you get a rectangle that is 101 X 101. You then say that if you do a 100 X 100 rect with a 2 pixel pen, you get what your after...
    Could it be that (as works with most imageing programs out there) that the border is being drawn on the next pixel out for odd number pen sizes, and dead center of the rectangle's lines for even number pen sizes.

    So, if you did a 10 wide pen, 5 of the pixels would be on the inside of the rect, and 5 would be outside of it. This means that your rect would look like it was 90 X 90 inside dimensions, but a 110 X 110 outside dimensions. And if you did a 9 wide pen, you would get 4 pixels of the border on the inside of the rect, and 5 on the outside, therefore adding one to the size of the rect (even though it was created with the same 100 X 100 dimensions.

    Just a thought I had, I have no facts to back it up...

  9. #9

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    I dont know, maybe you are right, but it's stupid. In my program I ask the user for the size of a rectangle, and then they're gunno see it one pixel bigger....
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  10. #10
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    One pixel is pretty small, how are you able to tell if you are getting a 100X100 or a 101X101 pixel rect?

  11. #11

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by hellswraith
    One pixel is pretty small, how are you able to tell if you are getting a 100X100 or a 101X101 pixel rect?
    by using ms paint's magnifier

    I mean, yeah you cant see it, but I just wanted my app to do it right. I guess it doesnt mather
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

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