wxImageList::Add()始终返回0

wxImageList::Add() always returns 0

本文关键字:返回 Add wxImageList      更新时间:2023-10-16

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

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

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

这对我来说似乎很清楚:使用Windows,返回的值来自对ImageList_AddMasked()/IsolationAwareImageList_AddMasked()/__IsolationAware_pfn()的调用,其中后者似乎返回了BOOL,但没有返回列表索引值。

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

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