Like most of us, I grew up on Win32 and MFC, and have grown used to what I
consider normal use of basic types/structures. However, I just ran into
another .NET class that seems to be unnecessarily restricted -- Rectangle.
Can someone explain to me _why_ Left, Top, Right, and Bottom are read-only? I
see absolutely *no* value in this, perhaps someone could enlighten me as to why
I can't /set/ these as well...
Thanks 4 1157
Rectangle is defined by it's height, width, and upper left corner (X, Y)
which are values you can "set". :) Thom
"Julie" wrote: Like most of us, I grew up on Win32 and MFC, and have grown used to what I consider normal use of basic types/structures. However, I just ran into another .NET class that seems to be unnecessarily restricted -- Rectangle.
Can someone explain to me _why_ Left, Top, Right, and Bottom are read-only? I see absolutely *no* value in this, perhaps someone could enlighten me as to why I can't /set/ these as well...
Thanks
tbain wrote: Rectangle is defined by it's height, width, and upper left corner (X, Y) which are values you can "set". :) Thom
Extending that logic, then there shouldn't be a getter for l, t, r, & b, but
there is. "Julie" wrote:
Like most of us, I grew up on Win32 and MFC, and have grown used to what I consider normal use of basic types/structures. However, I just ran into another .NET class that seems to be unnecessarily restricted -- Rectangle.
Can someone explain to me _why_ Left, Top, Right, and Bottom are read-only? I see absolutely *no* value in this, perhaps someone could enlighten me as to why I can't /set/ these as well...
Thanks
"Julie" <ju***@nospam.com> wrote: Rectangle is defined by it's height, width, and upper left corner (X, Y) which are values you can "set". :) Thom
Extending that logic, then there shouldn't be a getter for l, t, r, & b, but there is.
Why don't you write a simple wrapper class that (i) allows you to set
Left, Right, Top, and Bottom, and (ii) has an implicit conversion to
Rectangle?
P.
Paul E Collins wrote: "Julie" <ju***@nospam.com> wrote:
Rectangle is defined by it's height, width, and upper left corner (X, Y) which are values you can "set". :) Thom
Extending that logic, then there shouldn't be a getter for l, t, r, & b, but there is.
Why don't you write a simple wrapper class that (i) allows you to set Left, Right, Top, and Bottom, and (ii) has an implicit conversion to Rectangle?
P.
Yes, I realize that is possible, along w/ just converting coordinates (l, t, r,
b) to location/size, but... that isn't my question --
*WHY* was Rectangle originally designed this way?
- I see no benefit/optimization due to not including setters
- I see no reason that excludes rectangle use in terms of l, t, r, b
- I'm not aware of any design paradigms that dictate/indicate that a setter
in this case isn't desirable
Comments, reasons??? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steven T. Hatton |
last post by:
The following may strike many of you as just plain silly, but it represents
the kind of delelima I find myself in when trying to make a design
decision. This really is a toy project written for...
|
by: cjeffwang |
last post by:
I am doing examples in "JavaScript: the Definitive Guide." For Example
8-1, a rectangle constructor function, how do I print/write the
rectagle (x,y)?
Here is the JavaScript program:
...
|
by: kimos |
last post by:
hi all,
how to calculate the intersection of 2 rectangle
a rectangle is the following:
Rectangle makeRectangle (Point lowerLeft, Point upperRight) {
Rectangle r;
|
by: |
last post by:
I am having a hard time understanding the logic behind the Rectangle object.
My problem has to do with the way the rectangle treats the "Width" property.
For example, take the following rectangle...
|
by: DazedAndConfused |
last post by:
I have a rectangle around text that I want to fill in with color. I do not
know the height of the rectangle until I actually go through and draw out
the text. Is there a way of filling in the...
|
by: Florian Haag |
last post by:
Hello,
I'm trying to compile a programme which compiles fine under Linux; I'm
trying it with MinGW G++ 3.4.2:
Component.h:
#ifndef COMPONENT_H_
#define COMPONENT_H_
|
by: sklett |
last post by:
I have a situation where I'm getting in Image that has a gray (solid, same
color) background with a smaller white rectangle inside. The position is
not always the same. What I need to do is...
|
by: RobinS |
last post by:
I am drawing a rectangle on a picture that has already been drawn
on the graphics area (a user control). It works something like this:
//in the MouseDown event
m_isDragging = true;
m_oldX =...
|
by: kummu4help |
last post by:
hi,
i want to draw rectangle based on mousedrag event. if user dragging the mouse, then the rectangle on the applet should increase or decrease basing on current mouse coordinates.
i have the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |