xtd 0.2.0
Loading...
Searching...
No Matches
font_changed_event.cpp

demonstrates the use of idle event.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/message_box>
#include <xtd/forms/radio_button>
using namespace xtd;
using namespace xtd::forms;
namespace font_changed_event_example {
class form1 : public form {
public:
form1() {
radio_button1.location({0, 0});
radio_button1.name("radio_button1");
radio_button1.size({180, 25});
radio_button1.text("button1");
radio_button1.font_changed += event_handler(*this, &form1::radio_button1_font_changed);
radio_button2.location({0, 39});
radio_button2.name("radio_button2");
radio_button2.size({180, 17});
radio_button2.text("Change button1 font");
radio_button2.checked_changed += event_handler(*this, &form1::radio_button2_checked_changed);
client_size({292, 273});
controls().push_back_range({radio_button1, radio_button2});
name("Form1");
}
private:
void radio_button1_font_changed(object& sender, const event_args& e) {
message_box::show("The font has been chenged.");
}
void radio_button2_checked_changed(object& sender, const event_args& e) {
radio_button1.font({radio_button1.font().font_family(), 15.0f, drawing::font_style::bold | drawing::font_style::italic, drawing::graphics_unit::point, 0});
}
radio_button radio_button1;
radio_button radio_button2;
};
}
auto main() -> int {
application::run(font_changed_event_example::form1 {});
}
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Enables the user to select a single option from a group of choices when paired with other xtd::forms:...
Definition radio_button.hpp:40
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.hpp:32
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10