zoukankan      html  css  js  c++  java
  • VS2013中使用GDI+绘图

    VC范例,400多个例子源代码下载

    http://download.csdn.net/detail/bigtree_mfc/7727977

    VS2013中使用GDI+绘图和VC6.0不同,在VC6.0中能绘出的图像在VS2013中不会显示,原因就是在VS2013中需要添加初始化GDI+;

    绘图

    对话框视图类中:(绘图部分大同小异,)

    void **View::OnDraw(CDC *pDC)
    {

    //初始化部分

    GdiplusStartupInput gdiplusStartupInput;

    ULONG_PTR gdiplusToken;
    GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);


    HDC hdc = pDC->m_hDC;
    using namespace Gdiplus;
    Graphics graphics(hdc);
    graphics.SetSmoothingMode(SmoothingModeAntiAlias);
    Pen newPen(Color(0, 255, 255), 2);

    graphics.DrawLine(&newPen, 0, 0, 500, 500);
    }

    注:顶部添加GDI+定义注意要4行全部添加

    #pragma once
    #include <GdiPlus.h>
    #pragma comment(lib, "GdiPlus.lib")
    using namespace Gdiplus;

    效果:

     
     

    http://blog.csdn.net/bigtree_mfc/article/details/46858127

  • 相关阅读:
    JS中的constructor与prototype
    HTTP状态码
    CSS HACK 及常见问题
    js常见怪异
    js深拷贝和浅拷贝
    浏览器渲染
    google全球地址大全
    从function前面的!想到的
    2048
    js判定IE
  • 原文地址:https://www.cnblogs.com/findumars/p/5801430.html
Copyright © 2011-2022 走看看