国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

[C/C++/Easyx]07 消息處理—漂亮的按鈕

2023-08-19 17:26 作者:bili_80498477832  | 我要投稿

交作業(yè)doge, 自己加了點(diǎn)陰影效



#include<stdio.h>

#include<easyx.h>

#include <graphics.h>


ExMessage msg = { 0 };


bool button(int butx, int buty,int butw, int buth , const char* test) {//butx y為按鈕位置


??//繪制按鈕

??setfillcolor(BLACK);//陰影+

??solidroundrect(butx, buty, butx + butw +3, buty + buth+5, 20, 40);//+

??setlinecolor(BLACK);

??setlinestyle(PS_SOLID, 3);

??setfillcolor(RGB(200, 111, 103));

??fillroundrect(butx, buty, butx + butw, buty + buth, 20, 40);


??//繪制文本

??settextcolor(BLACK);

??int hspace = (butw - textwidth(test)) / 2;

??int wspace = (buth - textheight(test)) / 2;

??outtextxy(butx + hspace, buty + wspace, test);


??//鼠標(biāo)在這個(gè)區(qū)域?

??if (msg.x > butx && msg.x < butx + butw && msg.y > buty && msg.y < buty + buth) {

????setfillcolor(RED);

????fillroundrect(butx, buty, butx + butw, buty + buth, 20, 40);

??}


??//鼠標(biāo)在這個(gè)區(qū)域并且單機(jī)了左鍵?

??if (msg.message==WM_LBUTTONDOWN && msg.x > butx && msg.x < butx + butw && msg.y > buty && msg.y < buty + buth) {

????return true;

??}

??return false;???

}

int main() {


??//建立窗口

??initgraph(640, 480, EX_SHOWCONSOLE );

??setbkcolor(RGB(242, 222, 189));

??cleardevice();

??setbkmode(TRANSPARENT);//設(shè)置文字背景透明


??//

??while (true) {

????if (peekmessage(&msg, EX_MOUSE)) {//獲取鼠標(biāo)信息+

????}

????BeginBatchDraw();//

????if (button(180, 300, 100, 50, "Play")) {//x, y, wide, heigh, text

??????printf("Game Start\n");

????}

????if (button(380, 300, 100, 50, "Quit")) {//x, y, wide, heigh, text

??????printf("Closing...\n");

????}

????EndBatchDraw();

????msg.message = 0;

??}


??//保持顯示

??getchar();

??closegraph();

??return 0;

[C/C++/Easyx]07 消息處理—漂亮的按鈕的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
临泽县| 龙川县| 长寿区| 基隆市| 达孜县| 兴化市| 那坡县| 万州区| 鹤山市| 罗定市| 澄江县| 正宁县| 华亭县| 南靖县| 大新县| 碌曲县| 洮南市| 开封县| 翁源县| 宜都市| 盈江县| 永仁县| 平罗县| 苏尼特右旗| 宝丰县| 崇信县| 承德市| 石阡县| 雅安市| 鹤峰县| 平远县| 建水县| 常德市| 郁南县| 海口市| 云浮市| 淄博市| 阳高县| 镇坪县| 崇仁县| 车险|