Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试制作一个将图片框作为参数的函数。我怎么做?
前任:
void functionName(picturebox a){ if (... == ...){ a->Load("filePath") } }
您的错误很可能来自您的图片框被复制。
看到函数如何返回 void,您打算编辑图片框,但通过值传递它,该值调用复制构造函数并为该函数调用创建一个新的临时对象。
如果这是问题所在,请尝试通过引用传递图片框对象。
void functionName(picturebox& a){ if (... == ...){ a->Load("filePath") } }