你好 不知道为什么 我把我那个单独写的话就只有一个窗口 但写在你的程序里就出现了两个窗口
//背景的展示
//按钮的实现
void button(int x, int y, int w, int h, const char* text)
{
// button(50, 50, 150, 50, "按钮");
setbkmode(TRANSPARENT); //这个函数只能去掉 文字 的背景,
setfillcolor(BLACK); //设置填充颜色
fillroundrect(x, y, x + w, y + h, 10, 10); //这个函数用于画有边框的填充圆角矩形。
settextstyle(30, 0, "黑体"); //这个函数用于设置当前字体样式。
//下面几行是让文本在框内居中
char text_[50] = "button";
strcpy_s(text_, text);
int tx = x + (w - textwidth(text_)) / 2;
int ty = y + (h - textheight(text_)) / 2;
outtextxy(tx, ty, text); //文本
}
void ShowBk()
{
initgraph(width, height);//,EW_SHOWCONSOLE
IMAGE img1;
loadimage(&img1, "./马克思.jpg", width, height);
putimage(0, 0, &img1);
//四个按钮展示
button(0, height - b_height, b_width, 30, "播放音乐");
button(b_width, height - b_height, b_width, 30, "照片");
button(2 * b_width, height - b_height, b_width, 30, "文案");
button(3 * b_width, height - b_height, b_width, 30, "图案");
}