shows how to draw point in paint event using xtd::drawing::graphics::draw_point.
- Windows
-
- macOS
-
- Gnome
-
#include <xtd/xtd>
using namespace std;
namespace draw_point_example {
class form1 :
public form {
struct colored_point {
};
public:
form1() {
text(
"Draw point example");
generate_colored_points_timer.interval_milliseconds(200);
generate_colored_points_timer.tick +=
event_handler(*
this, &form1::generate_colored_points);
generate_colored_points_timer.start();
}
protected:
form::on_paint(e);
for (auto colored_point : colored_points)
}
private:
void generate_colored_points() {
static vector
colors = {color::red, color::green, color::blue, color::yellow, color::cyan, color::magenta, color::white};
for (auto& colored_point : colored_points)
invalidate();
}
vector<colored_point> colored_points;
timer generate_colored_points_timer;
};
}
auto main()->int {
application::run(draw_point_example::form1 {});
}