|
-
Dec 23rd, 2002, 12:52 AM
#1
stupid graphics.drawrectangle
this is stupid.
VB Code:
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!!
-
Dec 23rd, 2002, 01:03 AM
#2
yay gay
framework developers...not VS devolpers :P
\m/  \m/
-
Dec 23rd, 2002, 03:43 AM
#3
KING BODWAD XXI
-
Dec 23rd, 2002, 03:54 AM
#4
-
Dec 24th, 2002, 05:47 AM
#5
New Member
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>
-
Dec 24th, 2002, 03:29 PM
#6
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!!
-
Dec 24th, 2002, 07:18 PM
#7
Hyperactive Member
"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
-
Dec 24th, 2002, 07:39 PM
#8
PowerPoster
Re: stupid graphics.drawrectangle
Originally posted by MrPolite
this is stupid.
VB Code:
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...
-
Dec 25th, 2002, 02:10 PM
#9
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!!
-
Dec 25th, 2002, 06:26 PM
#10
PowerPoster
One pixel is pretty small, how are you able to tell if you are getting a 100X100 or a 101X101 pixel rect?
-
Dec 25th, 2002, 08:12 PM
#11
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|