本类支持各种常用图片格式,图片显示方式支持左上、中、右下、缩放、平铺等,背景支持透明、颜色填充等。
使用很简单,简单使用示例:
在头文件中定义:
CPictureEx m_pic;

设置属性:
m_pic.Attach(::GetDlgItem(m_hWnd, IDC_PIC1));
m_pic.LoadImage(AfxGetInstanceHandle( ), "img", "gif");
m_pic.SetBgMode(CPictureEx::BackgroundMode::TransparentBg, RGB(0, 0, 0));
运行效果截图:





源代码和示例程序下载:
http://javenreal.googlepages.com/PicExTest.rar
从理论上讲,应该支持MFC、SDK,并能自动适应ASCII、UNICODE,但由于时间关系本人并没有做完整的测试。
示例程序为vc7 MFC工程,还是从理论上讲,适应vc6应该没什么问题。
使用可以从现有的控件Attach,也可以直接CreateEx。和现有的控件绑定最好用STATIC,其它控件没有测试过。
此类依赖于Gdiplus,请先配置Gdiplus。
posted on 2007-03-14 23:33
郁郁寡欢 阅读(9569)
评论(14) 编辑 收藏 引用