找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1235|回复: 4

[求助]:dockbar上面放了一个treecontrol控件,在它的item中图片怎么不显示??

[复制链接]
发表于 2007-5-7 11:33:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我在一个dockbar上面放了一个treecontrol控件

用下面的代码实现在treecontrol树型结构显示内容中加入图片,怎么图片显示不出来?但留出图片大小的空间,就是看不到图片,麻烦各位帮帮忙看看,怎么回事!非常感谢!!!
         m_pImageList = new CImageList();
m_pImageList->Create(16,16, ILC_COLOR8, 0, 4);

m_bitmap.LoadBitmap(IDB_BITMAP_ROOT);
m_pImageList->Add(&m_bitmap, (COLORREF)0x000000);
m_pImageList->SetOverlayImage(0,1);
m_ctrltree.SetImageList(m_pImageList,0);
m_bitmap.DeleteObject();
m_bitmap.LoadBitmap(IDB_BITMAP_USER);
m_pImageList->Add(&m_bitmap, (COLORREF)0x000000);
m_pImageList->SetOverlayImage(2,1);
m_ctrltree.SetImageList(m_pImageList,0);
m_ctrltree.InsertItem("工程设计",0,0);
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2007-5-14 08:39:56 | 显示全部楼层
可能是子项的高度太小,设置子项的高度不小于图标高度:CTreeCtrl::SetItemHeight;再显示不出来那就是图像表的问题!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2007-5-15 13:37:12 | 显示全部楼层
资源切换问题
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-16 11:24:08 | 显示全部楼层
很感谢楼上两位的回复!不过不是高度的问题!
资源切换问题!楼上的朋友,能不能在详细点,这种问题怎么解决才能实现图标的显示了!麻烦你了!非常感谢!!1
实际上,上面的程序段放在CDialog派生的一般对话框中,可以像我们希望的那样,显示树形控件各项的图标。
是不是CAcUiDockControlBar类在使用上有什么特殊之处?再次请有经验的朋友给些指导。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2007-5-23 22:49:20 | 显示全部楼层
The ObjectARX SDK provides two simple C++ classes that can be used to make resource management easier. The CAcExtensionModule class serves two purposes—it provides a placeholder for an AFX_EXTENSION_MODULE structure (normally used to initialize or terminate an MFC extension DLL) and tracks two resource providers for the DLL. The resource providers are the module's resources (which are normally the DLL itself, but may be set to some other module) and the default resources (normally the host application, but are actually the provider currently active when AttachInstance() is called). CAcExtensionModule tracks these to simplify switching MFC resource lookup between the default and the module's. A DLL should create one instance of this class and provide the implementation for the class.

或者使用:
Use an instance of this class to switch between resource providers. When the object is constructed, a new resource provider will get switched in. Upon destruction, the original resource provider will be restored. The following code provides an example:

void MyFunc ()
{
    CAcModuleResourceOverride myResources;
}
Upon entry to this function the module's resources will be selected. When the function returns, the default resources will be restored. A resource override can be selected in any of the following ways:

Use the default constructor (no arguments), or pass NULL (or 0) to the constructor. The DLL's resources will be selected. The default resources will be restored when the CAcModuleResourceOverride destructor is called. The DLL and default resource handles are tracked by the DLL's CAcExtensionModule.
Pass a non-NULL handle to the constructor. The resources of the module associated with the given handle will be selected. The default resources will be restored when the CAcModuleResourceOverride destructor is called.
Two macros—AC_DECLARE_EXTENSION_MODULE and AC_IMPLEMENT_EXTENSION_MODULE—help define and implement the classes in your application.

The following code illustrates how to make use of the CAcExtensionModule and CAcModuleResourceOverride classes in an ObjectARX application:

AC_IMPLEMENT_EXTENSION_MODULE(theArxDLL);
HINSTANCE _hdllInstance = NULL;
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    // Remove this if you use lpReserved
    UNREFERENCED_PARAMETER(lpReserved);
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        theArxDLL.AttachInstance(hInstance);
        hdllInstance = hInstance;
    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
        theArxDLL.DetachInstance();  
    }
    return 1;   // ok
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-24 02:29 , Processed in 0.372193 second(s), 37 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表