xtd 0.2.0
flat_button.cpp

demonstrates the use of xtd::forms::button control with flat style.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include "../resources/gammasoft_32x32.xpm"
#include "../resources/gammasoft_64x64.xpm"
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Flat button example");
controls().push_back_range({button1, button2, button3, button4});
button1.location({40, 40});
button1.text("button1");
button2.location({40, 80});
button2.back_color(color::green);
button2.flat_appearance(flat_button_appearance().border_color(color::light_green)
.border_size(2)
.mouse_over_back_color(color::light_green)
.mouse_down_back_color(color::dark_green));
button2.text("button2");
button3.location({40, 120});
button3.size({140, 40});
button3.image(image::from_xpm_data(gammasoft_32x32_xpm));
button3.text("Gammasoft");
button4.location({40, 175});
button4.flat_appearance(flat_button_appearance().border_size(0));
button4.flat_style(xtd::forms::flat_style::flat);
button4.size({70, 70});
button4.image(image::from_xpm_data(gammasoft_64x64_xpm));
}
private:
button button4;
};
auto main() -> int {
application::run(form1 {});
}
static const xtd::drawing::color green
Gets a system-defined color that has an ARGB value of 0xFF008000. This field is constant.
Definition color.hpp:212
static const xtd::drawing::color light_green
Gets a system-defined color that has an ARGB value of 0xFF90EE90. This field is constant.
Definition color.hpp:263
static const xtd::drawing::color dark_green
Gets a system-defined color that has an ARGB value of 0xFF006400. This field is constant.
Definition color.hpp:134
static bitmap from_xpm_data(const char *const *bits)
Creates an xtd::drawing::image from the specified data pointer.
static void run()
Begins running a standard application message loop on the current thread, without a form.
Represents a Windows button control.
Definition button.hpp:49
Provides properties that specify the appearance of xtd::forms::button controls whose xtd::forms::flat...
Definition flat_button_appearance.hpp:24
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
@ button1
The first button on the message box is the default button.
Definition message_dialog_default_button.hpp:24
@ button3
The third button on the message box is the default button.
Definition message_dialog_default_button.hpp:28
@ button2
The second button on the message box is the default button.
Definition message_dialog_default_button.hpp:26
@ flat
The control appears flat.
Definition flat_style.hpp:26
@ middle_left
Content is vertically aligned in the middle, and horizontally aligned on the left.
Definition content_alignment.hpp:29
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