当前位置:网站首页>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;
}
}
}
}
}
边栏推荐
- C# TCP如何设置心跳数据包,才显得优雅呢?
- 【beanshell】数据写入本地多种方法
- Jarvis OJ Flag
- 国内首家 EMQ 加入亚马逊云科技「初创加速-全球合作伙伴网络计划」
- tf. sequence_ Mask function explanation case
- Is it safe to open a securities account by mobile phone? Detailed steps of how to buy stocks
- Games101 notes (I)
- Deeply cultivate 5g, and smart core continues to promote 5g applications
- Jarvis OJ 简单网管协议
- 如何将mysql卸载干净
猜你喜欢
解决CMakeList find_package找不到Qt5,找不到ECM
PHP人才招聘系统开发 源代码 招聘网站源码二次开发
Jarvis OJ Flag
Use JDBC technology and MySQL database management system to realize the function of course management, including adding, modifying, querying and deleting course information.
Hiengine: comparable to the local cloud native memory database engine
拷贝方式之DMA
Android 隐私沙盒开发者预览版 3: 隐私安全和个性化体验全都要
浏览器渲染原理以及重排与重绘
Fleet tutorial 09 basic introduction to navigationrail (tutorial includes source code)
干货!半监督预训练对话模型 SPACE
随机推荐
Wsl2.0 installation
Jarvis OJ Flag
Get ready for the pre-season card game MotoGP ignition champions!
Embedded-c Language-1
关于new Map( )还有哪些是你不知道的
Error in composer installation: no composer lock file present.
Benji Banas membership pass holders' second quarter reward activities update list
Learnopongl notes (I)
如何将mysql卸载干净
Solve cmakelist find_ Package cannot find Qt5, ECM cannot be found
Benji Bananas 会员通行证持有人第二季奖励活动更新一览
麻烦问下,DMS中使用Redis语法是以云数据库Redis社区版的命令为参考的嘛
Jarvis OJ Flag
Data verification before and after JSON to map -- custom UDF
中国广电正式推出5G服务,中国移动赶紧推出免费服务挽留用户
SQL injection of cisp-pte (Application of secondary injection)
Jarvis OJ simple network management protocol
tf. sequence_ Mask function explanation case
Iphone14 with pill screen may trigger a rush for Chinese consumers
File operation --i/o