• 中国加油


    不过我偷懒了hhhhhhh

    //windows.h文件中包含应用程序中所需的数据类型和数据结构的定义
    #include<windows.h>
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);//窗口函数说明
    //---------以下初始化窗口类--------------
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdLine,int nCmdShow)
    {
        HWND hwnd;
        MSG Msg;
        WNDCLASS wndclass;
        char lpszClassName[] = "窗口";     //窗口类名
        char lpszTitle[] = "My_Windows";    //窗口标题名
    
        //窗口类的定义
        wndclass.style = CS_HREDRAW | CS_VREDRAW;                  //窗口类型为默认类型
        wndclass.lpfnWndProc = WndProc;      //窗口处理函数为WndProc
        wndclass.cbClsExtra = 0;             //窗口类无扩展
        wndclass.cbWndExtra = 0;             //窗口实例无扩展
        wndclass.hInstance = hInstance;     //当前实例句柄
    
        wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);//窗口的最小化图标为默认图标
        wndclass.hCursor = LoadCursor( NULL, IDC_ARROW); //窗口 采用箭头光标
        wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); //窗口 背景为 白色
        wndclass.lpszMenuName = NULL ; //窗口 中无菜单
        wndclass.lpszClassName = lpszClassName; //窗口类名为“窗口示例”
    //-----------以下进行窗口类的注册
        if (!RegisterClass(&wndclass))//如果注册失败则发出警吿声音
        {
            MessageBeep (0);
            return FALSE;
        }
    
    //创建窗口
        hwnd = CreateWindow(
                            lpszClassName, //窗口类名
                            lpszTitle,      //窗口实例的标题名
                            WS_OVERLAPPEDWINDOW, //窗口 的风格
                            CW_USEDEFAULT,
                            CW_USEDEFAULT,  //窗口左上角坐标为默认值
                            CW_USEDEFAULT,
                            CW_USEDEFAULT,  //窗口的髙和宽为默认值
                            NULL,           //此窗口无父窗口
                            NULL,           //此窗口无主菜单
                            hInstance,      //创建此窗口应用程序的当前句柄
                            NULL            //不使用该值
                            );
    
    
    
        ShowWindow( hwnd, nCmdShow);        //显示窗口
        UpdateWindow(hwnd);                 //绘制用户区
        while( GetMessage(&Msg, NULL, 0, 0)) //消息循环
        {
            TranslateMessage(&Msg);
            DispatchMessage(&Msg);
        }
        return Msg.wParam;                  //程序终止时将信息返回系统
    }
    
    
    
    #define LaR (rect.right+rect.left)
    #define UaD (rect.top+rect.bottom)
    //窗口函数
    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        HDC hDC;
        HBRUSH hBrush;
        HPEN hPen;
        RECT rect;
        PAINTSTRUCT PtStr;
        POINT pt;
    
        switch(message)
        {
        case WM_PAINT:
            hDC = BeginPaint(hWnd, &PtStr);
            GetClientRect(hWnd, &rect);
    
            // Z
            hPen = CreatePen(PS_SOLID, 10, RGB(255,0,0));
            SelectObject(hDC, hPen);
            MoveToEx(hDC, LaR/16, UaD/3, NULL);
            LineTo(hDC, LaR/16*3, UaD/3);
            LineTo(hDC, LaR/16, UaD/3*2);
            LineTo(hDC, LaR/16*3, UaD/3*2);
    
            //G
            MoveToEx(hDC, LaR/16*7, UaD/3, NULL);
            LineTo(hDC, LaR/16*5, UaD/3);
            LineTo(hDC, LaR/16*5, UaD/3*2);
            LineTo(hDC, LaR/16*7, UaD/3*2);
            LineTo(hDC, LaR/16*7, UaD/2);
            LineTo(hDC, LaR/16*6, UaD/2);
    
            //J
            MoveToEx(hDC, LaR/16*9, UaD/3, NULL);
            LineTo(hDC, LaR/16*11, UaD/3);
            MoveToEx(hDC, LaR/16*10, UaD/3, NULL);
            LineTo(hDC, LaR/16*10, UaD/3*2);
            LineTo(hDC, LaR/16*9, UaD/3*2);
            LineTo(hDC, LaR/16*9, UaD/9*5);
    
            //Y
            MoveToEx(hDC, LaR/16*13, UaD/3, NULL);
            LineTo(hDC, LaR/16*14, UaD/9*4);
            LineTo(hDC, LaR/16*15, UaD/3);
            MoveToEx(hDC, LaR/16*14, UaD/9*4, NULL);
            LineTo(hDC, LaR/16*14, UaD/3*2);
    
    
    
            DeleteObject(hPen);
            EndPaint(hWnd, &PtStr);
    
            return 0;
    
        case WM_DESTROY:
            PostQuitMessage(0);                 //调用 PostQuitMessage 发出 WM_QUIT 消息
            return 0;
        default:
            return DefWindowProc(hWnd, message, wParam, lParam); //默认时采用系统消息默认处理函数
    
        }
    
    }
  • 相关阅读:
    VS Code 的常用快捷键
    oj教程--坑
    oj教程--学习顺序
    oj教程--链表
    oj教程--队列
    oj教程--栈
    【MySQL】汇总数据
    【MySQL】使用WHERE子句
    【MySQL】SELECT语句
    【MySQL】使用MySQL(连接、选择数据库、显示数据库和表信息)
  • 原文地址:https://www.cnblogs.com/Vikyanite/p/12448376.html
Copyright © 2020-2023  润新知