xtd 0.2.0
Loading...
Searching...
No Matches

◆ y() [1/2]

int32 xtd::drawing::point::y ( ) const
noexcept

Gets the y-coordinate of this xtd::drawing::point.

Returns
The y-coordinate of this xtd::drawing::point.
Examples
The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_Click(object& sender, const event_args& e) {
// Construct a new point with integers.
point point1(100, 100);
// Create a Graphics object.
graphics form_graphics = create_graphics();
// Construct another point, this time using a xtd::drawing::size.
point point2(size(100, 100));
// Call the equality operator to see if the points are equal, and if so print out their x and y values.
if (point1 == point2) {
form_graphics.draw_string(string::format("point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()), font(), brushes::black, point_f(10, 70));
}
}
static xtd::drawing::solid_brush black()
A system-defined brush object.
Defines a particular format for text, including font face, size, and style attributes....
Definition font.h:45
void draw_string(const xtd::string &s, const xtd::drawing::font &font, const xtd::drawing::brush &brush, const xtd::drawing::rectangle_f &layout_rectangle)
Draws the specified text string at the specified rectangle with the specified xtd::drawing::brush and...
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.h:70
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.h:35
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.h:54
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:31
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
static basic_string format(const basic_string< char > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
@ e
The E key.
Examples
animation.cpp, minesweeper.cpp, and screen.cpp.