当前位置:网站首页>The third lesson of EasyX learning
The third lesson of EasyX learning
2022-07-05 17:05:00 【Blue whale not blue 369】
Mouse messages need to use MOUSEMSG type , such as MOUSEMSG msg;
And then use MouthHit() Function to determine whether there is a mouse message ( left-click , Right click , middle , Move )
If there is a mouse message, you can receive the mouse message msg=GetMouseMsg();
Main members of mouse message :
- uMsg // Current mouse message
- x // The current mouse x coordinate
- y // The current mouse y coordinate
uMsg It can be used to judge what the current mouse message is :
- WM_LBUTTONDOWN Left mouse button message
- WM_RBUTTONDOWN Right mouse button message
For the new version of Easyx New content added
You need to use library functions **<easyx.h>**
Use ExMessage type , such as ExMessage msg;
And then use **peekmessage()** The function selects the identified content
For example, set a button
void test1(int x, int y, int w, int h) {
setbkmode(TRANSPARENT);
setfillcolor(BROWN);
fillroundrect(x, y, x + w, y + h, 10, 10);
char arr[] = "button";
settextstyle(30, 0, " In black ");
int width = x + (w - textwidth(arr)) / 2;
int height = y + (h-textheight(arr)) / 2;
outtextxy(width,height , "button");
ExMessage msg;
while (1) {
if (peekmessage(&msg, EM_MOUSE)) {
switch (msg.message) {
case WM_LBUTTONDOWN:
if (msg.x >= 50 && msg.x <= 50 + 150 && msg.y >= 50 && msg.y <= 50 + 150) {
cout << " I'm the button , I got clicked " << endl; break;
}
}
}
}
}
边栏推荐
- Copy mode DMA
- 手机开证券账户安全吗?怎么买股票详细步骤
- Do sqlserver have any requirements for database performance when doing CDC
- 国产芯片产业链两条路齐头并进,ASML真慌了而大举加大合作力度
- Use byte stream to read Chinese from file to console display
- 浏览器渲染原理以及重排与重绘
- Android privacy sandbox developer preview 3: privacy, security and personalized experience
- Learnopongl notes (II) - Lighting
- Jarvis OJ shell流量分析
- [729. My schedule I]
猜你喜欢
二叉树相关OJ题
[61dctf]fm
The survey shows that the failure rate of traditional data security tools in the face of blackmail software attacks is as high as 60%
国产芯片产业链两条路齐头并进,ASML真慌了而大举加大合作力度
Benji Bananas 会员通行证持有人第二季奖励活动更新一览
[brush title] goose factory shirt problem
Jarvis OJ Flag
【剑指 Offer】63. 股票的最大利润
美国芯片傲不起来了,中国芯片成功在新兴领域夺得第一名
Solve cmakelist find_ Package cannot find Qt5, ECM cannot be found
随机推荐
Practical example of propeller easydl: automatic scratch recognition of industrial parts
How does the outer disk futures platform distinguish formal security?
[Jianzhi offer] 62 The last remaining number in the circle
High number | summary of calculation methods of volume of rotating body, double integral calculation of volume of rotating body
How to install MySQL
Raspberry pie 4B installation pytorch1.11
Use JDBC technology and MySQL database management system to realize the function of course management, including adding, modifying, querying and deleting course information.
Deep dive kotlin synergy (XXI): flow life cycle function
Solution of vant tabbar blocking content
Jarvis OJ 远程登录协议
sqlserver 做cdc 要对数据库性能有什么要求么
Benji Bananas 会员通行证持有人第二季奖励活动更新一览
什么是ROM
高数 | 旋转体体积计算方法汇总、二重积分计算旋转体体积
Timestamp strtotime the day before or after the date
Hiengine: comparable to the local cloud native memory database engine
机器学习编译第2讲:张量程序抽象
关于new Map( )还有哪些是你不知道的
Is it safe to open an account for digging wealth stocks? How is it safe to open a stock account?
Yarn common commands