xtd 0.2.0
font_families.cpp

demonstrates the use of xtd::drawing::font_families method, which returns an array of xtd::drawing::font_family objects associated with the current graphics context.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/list_box>
using namespace xtd;
using namespace xtd::collections::generic;
using namespace xtd::drawing;
using namespace xtd::forms;
namespace font_family_example {
class form1 : public form {
public:
form1() {
text("Font families example");
start_position(form_start_position::manual);
location({300, 150});
client_size({400, 500});
label_font_famlies_count.parent(*this);
label_font_famlies_count.auto_size(true);
label_font_famlies_count.location({20, 20});
list_box_font_families.parent(*this);
list_box_font_families.bounds({20, 60, 360, 420});
label_font_famlies_count.text(string::format("There are {0} font families :", font_families.size()));
for (drawing::font_family fontFamily : font_families)
list_box_font_families.items().push_back(fontFamily.name());
}
private:
label label_font_famlies_count;
list_box list_box_font_families;
};
}
auto main() -> int {
application::run(font_family_example::form1 {});
}
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:80
virtual size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(xtd::collections::generic::list::...
Definition list.hpp:438
Defines a group of type faces having a similar basic design and certain variations in styles....
Definition font_family.hpp:33
static xtd::array< font_family > families() noexcept
Returns an array that contains all the font_family objects associated with the current graphics conte...
static void run()
Begins running a standard application message loop on the current thread, without a form.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents a standard Windows label.
Definition label.hpp:38
@ location
Specifies that both the x and y coordinates of the control are defined.
Definition bounds_specified.hpp:30
@ bottom
Bind control edges to the bottom of its container.
Definition anchor_styles.hpp:25
@ right
Bind control edges to the right of its container.
Definition anchor_styles.hpp:29
@ left
Bind control edges to the left of its container.
Definition anchor_styles.hpp:27
@ top
Bind control edges to the top of its container.
Definition anchor_styles.hpp:23
@ manual
The position of the form is determined by the Location property.
Definition form_start_position.hpp:24
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:217
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8