zoukankan      html  css  js  c++  java
  • WM下的GDI+(续)

    上篇文章标题有误,应该是WM下的

    上次我试验了我的劳动成果,证明是不行的。不过这里有人给出一个可以实用的版本。我来说下我的试用成果。

    一、安装

    下载后,将文件复制到相应的文件夹中,inlcude文件我是到Windows Mobile 6 SDK\PocketPC\Include\Armv4i\GDI+(我只试用了WM^下)下,这样出问题好处理。lib文件到\Windows Mobile 6 SDK\PocketPC\Lib\Armv4i下。在引用路径也要加上这些路径。

    二、准备

    首先在头文件中加入

    include <gdiplus.h>
    using   namespace   Gdiplus; 

    #pragma   comment   (lib,   "LibGDIPlus.lib")

    在Oncreat事件中,调用

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

    进行初始化。在Ondestory事件中调用

    GdiplusShutdown(gdiplusToken);

    进行结束。

    可以将gdiplusToken设为公用变量,这样可以不出问题。但初始化不能在DLL中进行,不知道是为什么 。

    三、使用

    wince下的GDI+有好多功能没有实现:

    • No support to load image file directly from path
      Use IStream interface to load file data, use the stream interface version to create bitmap. Same goes for resource.
    • Windows Mobile doesn't support the following features:
      GDI Path (GDI path functions are not exported)
      Enhanced Meta file

    前一个我认为可这样解决一是使用ISTREAM但比较复杂,二是使用GDI

    m_bt=new Bitmap(::SHLoadImageFile(_T("\\Program Files\\aaa.png")),0);但支持范围有限。

    后面的我没试过。

    在试用中还发现些问题,比较重要的Drawimgae有18函数只有下面6个实现了

             Graphics::DrawImage(Image*,RectF&)
             Graphics::DrawImage(Image*,INT,INT,INT,INT)
     Graphics::DrawImage(Image*,PointF*,INT,REAL,REAL,REAL,REAL,Unit,ImageAttributes*,DrawImageAbort,VOID*)
            Graphics::DrawImage(Image*,REAL,REAL,REAL,REAL)
            Graphics::DrawImage(Image*,Rect&)   Graphics::DrawImage(Image*,RectF&,REAL,REAL,REAL,REAL,Unit,ImageAttributes*,DrawImageAbort,VOID*)
    这两个干脆没有原型

    Graphics::DrawImage(Image*,RectF&,RectF&,Unit,ImageAttributes*)
    Graphics::DrawImage(Image*,RectF*,Matrix*,Effect*,ImageAttributes*,Unit*)
    不过主要功能还是能实现了。还有就是RotateTransform也不支持,这个就比较苦恼了。

  • 相关阅读:
    MySQL5.7.19 服务挂掉 自动关闭 mysqld got exception 0xc000001d win 2008R2
    intellij IDEA VS(Visual Studio) 常用 高效 黄金 快捷键
    .Net MVC Cache 缓存技术总结
    HttpContext.Current.Cache 过期时间
    Sql Server 数据类型与 C# 数据类型对照
    Spring注解@Component、@Repository、@Service、@Controller @Resource、@Autowired、@Qualifier、@scope
    Hibernate注解映射联合主键的三种主要方式
    hibernate 查询全部数据的三种方法
    Springframework和Hibernate版本对应关系
    C# 反射总结 获取 命名空间 类名 方法名
  • 原文地址:https://www.cnblogs.com/zcmky/p/1585102.html
Copyright © 2011-2022 走看看