该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
const char g_szClassName[] = "Example";
const char g_szCaption[] = "Archimedes\' Screw";
const int ID_TIMER1 = 1,
    nScreenWidth = GetSystemMetrics(SM_CXSCREEN),
    nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    static bool flag = false;
    static double max_theta = 0;
    static PAINTSTRUCT ps;
    static HDC hDC, mDC;
    switch (msg)
    {
    case WM_PAINT:
        hDC = BeginPaint(hWnd, &ps);
        for (double theta = 0; theta
            SetPixel(hDC, nScreenWidth/2+10*cos(theta)*theta, nScreenHeight/2+10*sin(theta)*theta, RGB(255,0,0));
        UpdateWindow(hWnd);
        EndPaint(hWnd, &ps);
        return 0;
    case WM_TIMER:
        if (!flag)
        {
            if (max_theta
            {
                max_theta += 5;
                InvalidateRect(hWnd, NULL, TRUE);
            }
            else flag = true;
        }
        else if (max_theta > 0)
        {
            max_theta -= 5;
            InvalidateRect(hWnd, NULL, TRUE);
        }
        else KillTimer(hWnd, ID_TIMER1);
        return 0;
    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;
    }
    return DefWindowProcA(hWnd, msg, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASSA wc;
    HWND hWnd;
    MSG msg;
    wc.style        = 0;
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/bian-cheng-ji-chu/99556.html