xtd 0.2.0
month_calendar.cpp

demonstrates the use of xtd::forms::month_calendar control.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/month_calendar>
#include <chrono>
using namespace std::chrono;
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Month calendar example");
month_calendar1.parent(*this);
month_calendar1.location({10, 10});
month_calendar1.date_changed += [&](object&, const event_args & e) {
label1.text(string::format("selection range: [{:d}, {:d}]", month_calendar1.selection_start(), month_calendar1.selection_end()));
};
month_calendar1.selection_range({date_time::now(), date_time::now()});
month_calendar1.min_date(date_time::now().subtract(months(3)));
month_calendar1.max_date(date_time::now().add(months(3)));
label1.parent(*this);
label1.auto_size(true);
label1.location({10, 180});
label1.text(string::format("selection range: [{:d}, {:d}]", month_calendar1.selection_start(), month_calendar1.selection_end()));
}
private:
month_calendar month_calendar1;
label label1;
};
auto main() -> int {
application::run(form1 {});
}
static date_time now() noexcept
Gets a xtd::date_time object that is set to the current date and time on this computer,...
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
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
Represents a control that displays a month calendar.
Definition month_calendar.hpp:40
@ add
The Add key.
Definition console_key.hpp:170
@ subtract
The Subtract key.
Definition console_key.hpp:174
@ e
The E key.
Definition console_key.hpp:96
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