⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program_7_2.cpp

📁 本程序为visual c++课件讲义
💻 CPP
字号:
// program 7.2: Display color palette
#include <rect.h>
SimpleWindow ColorWindow("Color Palette", 8.0, 8.0);
int ApiMain() {
    const float SideSize = 1.0;
    float XPosition = 1.5;
    const float YPosition = 4;
    ColorWindow.Open();
    // Create a RectangleShape to use
    RectangleShape ColorPatch(ColorWindow,
        XPosition, YPosition, White, SideSize, SideSize);
    // Loop over colors drawing ColorSquare with
    // that color next to the previous square
    for (color c=Red; c<=Magenta; c=(color(c+1))) {
        ColorPatch.SetColor(c);
        ColorPatch.SetPosition(XPosition, YPosition);
        ColorPatch.Draw();
        XPosition += SideSize;
    }
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -