当前位置:网站首页>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;
}
}
}
}
}
边栏推荐
- tf. sequence_ Mask function explanation case
- Allusions of King Xuan of Qi Dynasty
- Data verification before and after JSON to map -- custom UDF
- Summary of PHP pseudo protocol of cisp-pte
- China Radio and television officially launched 5g services, and China Mobile quickly launched free services to retain users
- Jarvis OJ Webshell分析
- Learnopongl notes (I)
- 【729. 我的日程安排表 I】
- Combined use of vant popup+ other components and pit avoidance Guide
- [729. My schedule I]
猜你喜欢
随机推荐
Jarvis OJ 远程登录协议
Excuse me, is the redis syntax used in DMS based on the commands of the redis community version of the cloud database
Iphone14 with pill screen may trigger a rush for Chinese consumers
easyNmon使用汇总
Cs231n notes (bottom) - applicable to 0 Foundation
网上办理期货开户安全吗?网上会不会骗子比较多?感觉不太靠谱?
How was the middle table destroyed?
【 brosser le titre 】 chemise culturelle de l'usine d'oies
Jarvis OJ Flag
Apple has abandoned navigationview and used navigationstack and navigationsplitview to implement swiftui navigation
Wechat official account web page authorization login is so simple
PHP人才招聘系统开发 源代码 招聘网站源码二次开发
[wechat applet] read the life cycle and route jump of the applet
深耕5G,芯讯通持续推动5G应用百花齐放
国内首家 EMQ 加入亚马逊云科技「初创加速-全球合作伙伴网络计划」
腾讯音乐上线新产品“曲易买”,提供音乐商用版权授权
7.Scala类
Games101 notes (III)
Jarvis OJ Flag
二叉树相关OJ题