Accessories for Application Programming

By

Accessories for Application Programming

The Point for a Location

Because a control’s location can be identified with two values, it can also be illustrated as a geometric point on the coordinate system of the screen. A point is a pixel on the monitor screen, on a form, or on any object of your application. A point is represented by its coordinates with regard to the object that "owns" the point:

To identify the concept of a point, the System.Drawing namespace provides the Point structure. One of the properties of the Point structure is X, which represents the horizontal distance of the point from the top-left corner of the object that owns the point. Another property, Y, represents the vertical measurement of the point with regards to the top-left corner of the object that owns the point.

The properties of a .NET Framework's Size structure are defined as natural numbers. In some cases, you may need to use the values of these properties as decimal numbers. To support this, you can use the PointF structure. Its behavior is the same as the Point structure except that its properties are declared as float values.

The Size With Dimensions

To represent the size of something, the .NET Framework provides the Size structure that is equipped with two main properties. The Width is the distance from the left to the right borders of a Size value. The Height property represents the distance from the top to the bottom borders of a Size value.

Besides Size, the .NET Framework also provides the SizeF structure. It uses the same properties as Size except that its members float values.

The Rectangle as a Combination of Location and Size

A rectangle is a geometric figure that has four sides. In the .NET Framework, a rectangle is a figure that illustrates a Size value located by a Point. Based on this, a rectangle has a location and dimensions. Therefore, a rectangle can be represented as follows:
 

Like every geometric representation in your program, a rectangular figure is based on a coordinate system whose origin is located on a top-left corner. The object that "owns" or defines the rectangle also owns this origin. For example, if the rectangle belongs to a control that is positioned on a form, then the origin is on the top-left corner just under the title bar of the form, provided the form has a title bar.

The Width property represents the distance from the left to the right borders of the rectangle. The Height property represents the distance from the top to the bottom borders of the rectangle.

0 comments:

Posting Komentar