当前位置:网站首页>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;
}
}
}
}
}
边栏推荐
- Apple has abandoned navigationview and used navigationstack and navigationsplitview to implement swiftui navigation
- Solve cmakelist find_ Package cannot find Qt5, ECM cannot be found
- Jarvis OJ shell traffic analysis
- Jarvis OJ webshell analysis
- 【729. 我的日程安排表 I】
- Yarn common commands
- Benji Bananas 会员通行证持有人第二季奖励活动更新一览
- Iphone14 with pill screen may trigger a rush for Chinese consumers
- Embedded-c Language-1
- 通过proc接口调试内核代码
猜你喜欢
干货!半监督预训练对话模型 SPACE
Android 隐私沙盒开发者预览版 3: 隐私安全和个性化体验全都要
Benji Banas membership pass holders' second quarter reward activities update list
Enter a command with the keyboard
Jarvis OJ shell traffic analysis
Cs231n notes (bottom) - applicable to 0 Foundation
深潜Kotlin协程(二十一):Flow 生命周期函数
[brush title] goose factory shirt problem
Solve cmakelist find_ Package cannot find Qt5, ECM cannot be found
Iphone14 with pill screen may trigger a rush for Chinese consumers
随机推荐
composer安装报错:No composer.lock file present.
Facing new challenges and becoming a better self -- attacking technology er
Machine learning compilation lesson 2: tensor program abstraction
Games101 notes (II)
Excuse me, is the redis syntax used in DMS based on the commands of the redis community version of the cloud database
American chips are no longer proud, and Chinese chips have successfully won the first place in emerging fields
Little knowledge about C language (array and string)
Learnopongl notes (I)
Android privacy sandbox developer preview 3: privacy, security and personalized experience
Do sqlserver have any requirements for database performance when doing CDC
【机器人坐标系第一讲】
JSON转MAP前后数据校验 -- 自定义UDF
Wechat official account web page authorization login is so simple
PHP人才招聘系统开发 源代码 招聘网站源码二次开发
Clear restore the scene 31 years ago, volcanic engine ultra clear repair beyond classic concert
如何将mysql卸载干净
SQL injection of cisp-pte (Application of secondary injection)
How can C TCP set heartbeat packets to be elegant?
解决CMakeList find_package找不到Qt5,找不到ECM
What else do you not know about new map()