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

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

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/progress_bar>
#include <xtd/forms/timer>
using namespace xtd;
using namespace xtd::forms;
namespace progress_bar_example {
class form1 : public form {
public:
form1() {
text("Progress bar example");
client_size({300, 300});
progress_bar1.parent(*this);
progress_bar1.location({50, 50});
progress_bar1.width(200);
progress_bar2.parent(*this);
progress_bar2.location({50, 80});
progress_bar2.value(50);
progress_bar2.width(200);
progress_bar3.parent(*this);
progress_bar3.location({50, 110});
progress_bar3.maximum(300);
progress_bar3.increment(300);
progress_bar3.width(200);
progress_bar4.parent(*this);
progress_bar4.location({50, 140});
progress_bar4.step(1);
progress_bar4.width(200);
progress_bar5.parent(*this);
progress_bar5.location({50, 170});
progress_bar5.maximum(200);
progress_bar5.minimum(100);
progress_bar5.style(progress_bar_style::marquee);
progress_bar5.width(200);
timer1.interval(50_ms);
timer1.tick += [&] {
progress_bar4.value(progress_bar4.value() < progress_bar4.maximum() ? progress_bar4.value() + 1 : progress_bar4.minimum());
};
timer1.enabled(true);
}
private:
timer timer1;
progress_bar progress_bar1;
progress_bar progress_bar2;
progress_bar progress_bar3;
progress_bar progress_bar4;
progress_bar progress_bar5;
};
}
auto main() -> int {
application::run(progress_bar_example::form1 {});
}
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents a Windows progress bar control.
Definition progress_bar.hpp:40
Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in...
Definition timer.hpp:38
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