当前位置:网站首页>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;
}
}
}
}
}
边栏推荐
- 美国芯片傲不起来了,中国芯片成功在新兴领域夺得第一名
- 【剑指 Offer】61. 扑克牌中的顺子
- Flet tutorial 12 stack overlapping to build a basic introduction to graphic and text mixing (tutorial includes source code)
- Jarvis OJ shell流量分析
- JSON转MAP前后数据校验 -- 自定义UDF
- Jarvis OJ Flag
- 【729. 我的日程安排錶 I】
- Data verification before and after JSON to map -- custom UDF
- Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
- sqlserver 做cdc 要对数据库性能有什么要求么
猜你喜欢

npm安装

The survey shows that the failure rate of traditional data security tools in the face of blackmail software attacks is as high as 60%

Jarvis OJ 简单网管协议

Solve cmakelist find_ Package cannot find Qt5, ECM cannot be found

【jmeter】jmeter脚本高级写法:接口自动化脚本内全部为变量,参数(参数可jenkins配置),函数等实现完整业务流测试

Practical example of propeller easydl: automatic scratch recognition of industrial parts

【剑指 Offer】63. 股票的最大利润

File operation --i/o
![[Jianzhi offer] 63 Maximum profit of stock](/img/b6/c1dec97a23ac13aa53d1d202b83ef5.png)
[Jianzhi offer] 63 Maximum profit of stock

Precision epidemic prevention has a "sharp weapon" | smart core helps digital sentinels escort the resumption of the city
随机推荐
Games101 notes (III)
【微信小程序】一文读懂小程序的生命周期和路由跳转
NPM installation
Get ready for the pre-season card game MotoGP ignition champions!
【刷題篇】鹅廠文化衫問題
SQL injection of cisp-pte (Application of secondary injection)
手机开证券账户安全吗?怎么买股票详细步骤
Scratch colorful candied haws Electronic Society graphical programming scratch grade examination level 3 true questions and answers analysis June 2022
[729. My schedule I]
[Jianzhi offer] 62 The last remaining number in the circle
Fleet tutorial 09 basic introduction to navigationrail (tutorial includes source code)
【jmeter】jmeter脚本高级写法:接口自动化脚本内全部为变量,参数(参数可jenkins配置),函数等实现完整业务流测试
【刷题篇】有效的数独
[team PK competition] the task of this week has been opened | question answering challenge to consolidate the knowledge of commodity details
Wechat official account web page authorization login is so simple
sqlserver 做cdc 要对数据库性能有什么要求么
Is it safe to open futures accounts online? Will there be more liars online? Doesn't feel very reliable?
[wechat applet] read the life cycle and route jump of the applet
Deep learning plus
ECU简介