win11 cb 20.03下安装easyx2021
做了鼠标放在选项上左侧出现箭头的功能,请问一下为啥箭头经常会瞎闪,如何解决。
另外我又在VC6.0,安装的easyx2022上运行,发现箭头瞎闪问题明显减少甚至没有问题,是cb的问题吗
#include <stdio.h>
#include <easyx.h>
#include <graphics.h>
int main()
{
int n=0,m=0;
initgraph(1080,720,EW_SHOWCONSOLE);
ExMessage msg;
settextcolor(YELLOW);
settextstyle(70,0,"宋体",0,0,0,true,false,false);
outtextxy(540-textwidth("主 菜 单")/2,80,"主 菜 单");
settextcolor(WHITE);
settextstyle(50,0,"宋体",0,0,0,false,false,false);
outtextxy(540-textwidth("1.数学")/2,200,"1.数学");
outtextxy(540-textwidth("2.英语")/2,300,"2.英语");
outtextxy(540-textwidth("3.计算机")/2,400,"3.计算机");
outtextxy(540-textwidth("4.总分")/2,500,"4.总分");
outtextxy(540-textwidth("5.平均分")/2,600,"5.平均分");
settextcolor(YELLOW);
while(!n)
{
if(peekmessage(&msg,EM_MOUSE|EM_KEY))
{
switch(msg.message)
{
case WM_MOUSEMOVE:
if(540-textwidth("1.数学")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("1.数学")/2&&200<=msg.y&&msg.y<=200+textheight("数学"))
outtextxy(540-textwidth("1.数学")/2-textwidth("→"),200,"→");
if(540-textwidth("2.英语")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("2.英语")/2&&300<=msg.y&&msg.y<=300+textheight("英语"))
outtextxy(540-textwidth("2.英语")/2-textwidth("→"),300,"→");
if(540-textwidth("3.计算机")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("3.计算机")/2&&400<=msg.y&&msg.y<=400+textheight("计算机"))
outtextxy(540-textwidth("3.计算机")/2-textwidth("→"),400,"→");
if(540-textwidth("4.总分")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("4.总分")/2&&500<=msg.y&&msg.y<=500+textheight("总分"))
outtextxy(540-textwidth("4.总分")/2-textwidth("→"),500,"→");
if(540-textwidth("5.平均分")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("5.平均分")/2&&600<=msg.y&&msg.y<=600+textheight("平均分"))
outtextxy(540-textwidth("5.平均分")/2-textwidth("→"),600,"→");
if(!(540-textwidth("1.数学")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("1.数学")/2&&200<=msg.y&&msg.y<=200+textheight("数学")))
clearrectangle(540-textwidth("1.数学")/2-textwidth("→"),200,540-textwidth("1.数学")/2,200+textheight("→"));
if(!(540-textwidth("2.英语")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("2.英语")/2&&300<=msg.y&&msg.y<=300+textheight("英语")))
clearrectangle(540-textwidth("2.英语")/2-textwidth("→"),300,540-textwidth("2.英语")/2,300+textheight("→"));
if(!(540-textwidth("3.计算机")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("3.计算机")/2&&400<=msg.y&&msg.y<=400+textheight("计算机")))
clearrectangle(540-textwidth("3.计算机")/2-textwidth("→"),400,540-textwidth("3.计算机")/2,400+textheight("→"));
if(!(540-textwidth("4.总分")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("4.总分")/2&&500<=msg.y&&msg.y<=500+textheight("总分")))
clearrectangle(540-textwidth("4.总分")/2-textwidth("→"),500,540-textwidth("4.总分")/2,500+textheight("→"));
if(!(540-textwidth("5.平均分")/2-textwidth("→")<=msg.x&&msg.x<=540+textwidth("5.平均分")/2&&600<=msg.y&&msg.y<=600+textheight("平均分")))
clearrectangle(540-textwidth("5.平均分")/2-textwidth("→"),600,540-textwidth("5.平均分")/2,600+textheight("→"));
break;
case WM_LBUTTONDOWN:
if(540-textwidth("1.数学")/2<=msg.x&&msg.x<=540+textwidth("1.数学")/2&&200<=msg.y&&msg.y<=200+textheight("数学"))
n=1;
if(540-textwidth("2.英语")/2<=msg.x&&msg.x<=540+textwidth("2.英语")/2&&300<=msg.y&&msg.y<=300+textheight("英语"))
n=2;
if(540-textwidth("3.计算机")/2<=msg.x&&msg.x<=540+textwidth("3.计算机")/2&&400<=msg.y&&msg.y<=400+textheight("计算机"))
n=3;
if(540-textwidth("4.总分")/2<=msg.x&&msg.x<=540+textwidth("2.圆饼图")/2&&500<=msg.y&&msg.y<=500+textheight("总分"))
n=4;
if(540-textwidth("5.平均分")/2<=msg.x&&msg.x<=540+textwidth("5.平均分")/2&&600<=msg.y&&msg.y<=600+textheight("平均分"))
n=5;
break;
case WM_KEYDOWN:
if(msg.vkcode==97||msg.vkcode==49)
n=1;
if(msg.vkcode==98||msg.vkcode==50)
n=2;
if(msg.vkcode==99||msg.vkcode==51)
n=3;
if(msg.vkcode==100||msg.vkcode==52)
n=4;
if(msg.vkcode==101||msg.vkcode==53)
n=5;
break;
default:
break;
}
}
}
return 0;
}