Is this a bug?

  • Thread starter Thread starter Michael C
  • Start date Start date
M

Michael C

I'm setting the AutoScrollPosition of a scrollable control. I was having
quite a bit of trouble with it not doing what I expected. Eventually I
worked out that if you want it to have a negative value you have to pass in
a positive value, eg

Point p = new Point(100,100);
Console.WriteLine(p.ToString());
this.AutoScrollPosition = p;
Console.WriteLine(this.AutoScrollPosition.ToString());

will output:

{X=100,Y=100}
{X=-100,Y=-100}

They document this in the help as being the way it is designed to work but
what I suspect is they found it was a bug so documented it into a feature.
Or is there another reason it would work this way?

Cheers,
Michael
 
They document this in the help as being the way it is designed to work but
what I suspect is they found it was a bug so documented it into a feature.
Or is there another reason it would work this way?

I would work this way because that is how it was designed to work. You're a
programmer, right? So, you create the business rules in your code, right?
So, if you say that a property which is positive results in a result that
appears negative, that is the way it works. In this case, the result is a
distance, although it could be either horizontal or vertical, up, down,
right or left. A distance is never negative. Let's say that you and I are
standing 3 feet apart, and you are to my north. How far apart are we? (Hint:
3 feet)Now, you move to a position 3 feet to my south. How far apart are we?
(Hint: 3 feet) But are you still in the same postion relative to the North
Pole? (Hint: No) Is your distance from me, or your distance from the North
Pole, a negative number? (Hint: No)

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.
 
Kevin Spencer said:
I would work this way because that is how it was designed to work. You're
a programmer, right? So, you create the business rules in your code,
right? So, if you say that a property which is positive results in a
result that appears negative, that is the way it works.

Ok, but in all my years of programming I've never seen a property like this.
In this case, the result is a distance, although it could be either
horizontal or vertical, up, down, right or left. A distance is never
negative. Let's say that you and I are standing 3 feet apart, and you are
to my north. How far apart are we? (Hint: 3 feet)Now, you move to a
position 3 feet to my south. How far apart are we? (Hint: 3 feet) But are
you still in the same postion relative to the North Pole? (Hint: No) Is
your distance from me, or your distance from the North Pole, a negative
number? (Hint: No)

An old physics question is what is the difference between velocity and
speed? The answer is velocity has direction so can be positive or negative,
possibly in x,y and z (but not necessarily if the problem is only 1D or 2D
as is the case here). I'd say it's the same thing with distance and length,
distance has direction so can be positive or negative, especially if the
designers of the class so intended it be so (which they did in this case).
To pass in a value of +3 feet and get a result of -3feet seems crazy to me.

Michael
 
My point was simply that how to express such a concept as a relative
position is something that falls into the purview of an arbitrary decision
on the part of the developer/designer/architect. The distance represents an
offset. The developers and/or architects made a decision.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.
 
Kevin Spencer said:
My point was simply that how to express such a concept as a relative
position is something that falls into the purview of an arbitrary decision
on the part of the developer/designer/architect. The distance represents
an offset. The developers and/or architects made a decision.

I do agree with you on that although I'm not sure if the designers made a
decision to make it that way or made mistake. I guess it's something we'll
never know. :-)

Michael
 
Back
Top