-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
67 lines (62 loc) · 1.96 KB
/
main.cpp
File metadata and controls
67 lines (62 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "qtsgraph.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
/*
* Задаётся размер и положение окна
* (int w = 640, int h = 480, int x = -1, int y = -1, QWidget *parent = nullptr)
* В случае отрицательного значения x или y, окно создаётся в центре экрана.
*/
QTSGraph w(600, 600);
//w.SwapYAxis = true;
//w.MoveOtoCenter = true;
w.show();
return a.exec();
}
void QTSGraph::PaintBox()
{
// Начало рисования
//ShowAxes();
Circle(100, 100, 20);
Delay(1000);
Circle(200, 200, 20);
Delay(10);
Circle(300, 300, 20);
SetColor(clGreen);
Line(0, 0, 600, 600);
SetColor(0xFF0000);
Line(600, 0, 0, 600);
Rectangle(0, 0, 599, 599);
QColor c = Qt::blue;
SetColor(c);
SetTextStyle(10, 45, 0);
OutTextXY(70, 70, "Hello world!");
SetTextStyle(1, 0, 20);
OutTextXY(170, 50, "Кликните мышкой...");
int m = ReadMouseButton();
SetColor(clRed);
SetTextStyle(20, 0, 1);
if(m == 1) OutTextXY(150, 80, "Нажата левая кнопка");
else if(m == 2) OutTextXY(150, 80, "Нажата правая кнопка");
else if(m == 3) OutTextXY(150, 80, "Нажата средняя кнопка");
else OutTextXY(150, 80, "Нажата неизвестная кнопка");
SetTextStyle(30, 180, 2);
OutTextXY(460, 550, "Hello world!");
SetColor(0x999999);
SetPenStyle(5);
SetFillStyle(1, clMagenta);
Ellipse(250, 280, 350, 320);
TPixel p;
while(ReadMouseButton() != 2)
{
p = ReadMousePosition();
SetColor(clBlack);
SetPenStyle(1, 1);
SetFillStyle(1, clWhite);
Rectangle(10, 10, 100, 100);
SetTextStyle(16, 0, 0);
OutTextXY(30, 30, std::to_string(p.x));
OutTextXY(30, 60, std::to_string(p.y));
}
// Конец рисования
}