【发布时间】:2016-05-04 18:20:54
【问题描述】:
在下面的代码中,如果我在 first“If”条件之后不使用“Update()”,ListCtrl 将不更新项目,但 将即使在第二个“If”条件之后没有调用“Update()”方法,也要更新。为什么是这样?我只是想知道何时需要 Update() 何时不需要!
class MyDialog()
{
public:
void MyFunction();
private:
CListCtrl myListControl;
}
void MyDialog::Myfunction()
{
bool bCondition;
for (auto i = 0, i < myListControl.GetItemCount(); ++i)
{
auto n = myListControl.SetItemText(i, 1, "Start");
if (n)
myListControl.Update(i);
/*Update() is required here */
EvaluateCondition( bConditon);
if(bConditon)
myListControl.SetItemText(i, 1, "End");
/* Why is Update() ***Not*** required here? */
}
}
【问题讨论】: