Skip to content

How to create a form ?

Gammasoft edited this page Nov 12, 2023 · 5 revisions

| xtd | News | Gallery | Examples | Downloads | Documentation | Wiki | Support | Sources | Project | Gammasoft |

There are some ways for creating form.

form instantiation

Create a form with simply invoking the form constructor.

#include <xtd/forms/application>

using namespace xtd::forms;

auto main()->int {
  auto form1 = form {};
  form1.text("My first form");
  application::run(form1);
}

Inheritance from the form

Instantiate a form and simple call it with the form constructor.

#include <xtd/forms/application>

using namespace xtd::forms;

class form_main : public form {
public:
  form_main() {
    text("My first form");
  }
};

auto main()->int {
  application::run(form_main {});
}

Use create method

Call one of create static methods.

#include <xtd/forms/application>

using namespace xtd::forms;

auto main()->int {
  auto form1 = form::create("My first form");
  application::run(form1);
}

Remarks

This applies to all xtd framework controls.

See