首页 > 解决方案 > wxImageList::Add() 总是返回 0

问题描述

根据手册wxImageList::Add()应该返回新添加图像的索引位置。

但是在我的应用程序中,我只得到返回值0(当添加图像正常时)或-1(当它失败时)。当我调试到函数时

int wxImageList::Add(const wxBitmap& bitmap, const wxColour& maskColour)

这对我来说似乎很清楚:使用 Windows,返回的值来自对ImageList_AddMasked()//的调用IsolationAwareImageList_AddMasked()__IsolationAware_pfn()后者似乎返回 aBOOL但不是列表索引值。

所以我的问题是:如何获取最近添加的图像的索引值?

标签: c++windowswinapiwxwidgets

解决方案


显而易见的想法是只使用wxImageList::GetImageCount(),有什么问题吗?


推荐阅读