在VC中画图

cutegirlecho@163.com 2017-08-20 02:52:47
在VC中运行不了graphics.h,怎么处理?
...全文
158 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2017-08-21
  • 打赏
  • 举报
回复
easyx再好用,它也是二道贩子!
#pragma comment(lib,"user32")
#pragma comment(lib,"gdi32")
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
    PAINTSTRUCT ps;
    HDC hdc;
    HFONT hfont,ohfont;
    RECT r;
    COLORREF oc;

    switch(message) {
    case WM_CLOSE://按Alt+F4退出
        PostQuitMessage(0);
        break;
    case WM_PAINT:
        BeginPaint(hWnd, &ps);
        hdc = ps.hdc; // the device context to draw in
        GetClientRect(hWnd, &r); // Obtain the window's client rectangle
        hfont = CreateFont(200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "宋体");
        ohfont=(HFONT)SelectObject(hdc,hfont);
        oc=SetTextColor(hdc,0x00C080FF);
        SetBkMode(hdc, TRANSPARENT);
        TextOut(hdc,r.left+r.right/2-600, r.top+r.bottom/2-100,"最短画图程序",12);
        SelectObject(hdc,ohfont);
        SetTextColor(hdc,oc);
        DeleteObject(hfont);
        EndPaint(hWnd, &ps);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
    MSG msg             = {0};
    WNDCLASS wc         = {0};
    HBRUSH hbrh;
    hbrh=CreateSolidBrush(0x00000000);
    wc.lpfnWndProc      = WndProc;
    wc.hInstance        = hInstance;
    wc.hbrBackground    = hbrh;
    wc.lpszClassName    = "minwindowsapp";
    wc.hCursor          = LoadCursor(NULL,IDC_ARROW);
    if (0==RegisterClass(&wc)) return 1;

    if (NULL==CreateWindow(wc.lpszClassName,
                        "Minimal Windows Application",
                        WS_POPUP|WS_VISIBLE,
                        0,
                        0,
                        GetSystemMetrics(SM_CXSCREEN),
                        GetSystemMetrics(SM_CYSCREEN),
                        0,
                        0,
                        hInstance,
                        NULL))
        return 2;

    while( GetMessage( &msg, NULL, 0, 0 ) > 0 ) {
        DispatchMessage( &msg );
    }
    DeleteObject(hbrh);
    return 0;
}
ooolinux 2017-08-21
  • 打赏
  • 举报
回复
引用 5 楼 u011367219 的回复:
[quote=引用 3 楼 ooolinux的回复:][quote=引用 2 楼 u010165006 的回复:] 百度EasyX。
看它的说明和示例。[/quote] easyx是真的好用,不光是画图的函数,而且支持各种编译器(新版的不知道)。官网也有很多示例代码和教程[/quote] 支持各种编译器不了解,支持VC各个版本是有。
clague 2017-08-21
  • 打赏
  • 举报
回复
引用 3 楼 ooolinux的回复:
[quote=引用 2 楼 u010165006 的回复:] 百度EasyX。
看它的说明和示例。[/quote] easyx是真的好用,不光是画图的函数,而且支持各种编译器(新版的不知道)。官网也有很多示例代码和教程
zhagoodwell 2017-08-20
  • 打赏
  • 举报
回复
下个插件头文件 在CSDN下载里:
ooolinux 2017-08-20
  • 打赏
  • 举报
回复
引用 2 楼 u010165006 的回复:
百度EasyX。
看它的说明和示例。
ooolinux 2017-08-20
  • 打赏
  • 举报
回复
百度EasyX。
wang0635 2017-08-20
  • 打赏
  • 举报
回复
用 Turbo C 2.0 或 Borland C++

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧