当前位置:网站首页>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;
}
}
}
}
}
边栏推荐
- How was the middle table destroyed?
- 【Web攻防】WAF检测技术图谱
- Is it safe for qiniu business school to open a stock account? Is it reliable?
- 手机开证券账户安全吗?怎么买股票详细步骤
- Wsl2.0 installation
- 通过proc接口调试内核代码
- 【剑指 Offer】61. 扑克牌中的顺子
- Benji Bananas 会员通行证持有人第二季奖励活动更新一览
- High number | summary of calculation methods of volume of rotating body, double integral calculation of volume of rotating body
- [729. My Schedule i]
猜你喜欢

American chips are no longer proud, and Chinese chips have successfully won the first place in emerging fields

阈值同态加密在隐私计算中的应用:解读

Jarvis OJ Webshell分析

养不起真猫,就用代码吸猫 -Unity 粒子实现画猫咪

China Radio and television officially launched 5g services, and China Mobile quickly launched free services to retain users

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

Precision epidemic prevention has a "sharp weapon" | smart core helps digital sentinels escort the resumption of the city

Bs-xx-042 implementation of personnel management system based on SSM

Games101 notes (III)

Hiengine: comparable to the local cloud native memory database engine
随机推荐
[brush title] goose factory shirt problem
ECU简介
File operation --i/o
Jarvis OJ shell traffic analysis
微信公众号网页授权登录实现起来如此简单
tf. sequence_ Mask function explanation case
easyNmon使用汇总
sqlserver 做cdc 要对数据库性能有什么要求么
国产芯片产业链两条路齐头并进,ASML真慌了而大举加大合作力度
Benji Bananas 会员通行证持有人第二季奖励活动更新一览
如何将mysql卸载干净
Data verification before and after JSON to map -- custom UDF
Google Earth engine (GEE) -- a brief introduction to kernel kernel functions and gray level co-occurrence matrix
Apple has abandoned navigationview and used navigationstack and navigationsplitview to implement swiftui navigation
Iphone14 with pill screen may trigger a rush for Chinese consumers
兰空图床苹果快捷指令
Detailed explanation of use scenarios and functions of polar coordinate sector diagram
拷贝方式之DMA
Sentinel flow guard
Games101 notes (III)