clistctrl没有立即显示像《统计》的文字

发布于 2025-01-26 02:17:32 字数 582 浏览 3 评论 0原文

我有这样的代码将安装日志写入静态文本和列表控件,并且我有一个按钮来启动通过function onclickinstallbtn()> nasther的安装程序,但是每当我调用<<代码> writelogtoscreen(),只有静态文本更改,并且列表中没有显示任何内容,直到完成onclickinstallbtn()完成,并且该列表上的所有内容都显示为一个。

我该如何像静态文本一样立即显示出来?

WriteLogtoScreen(LPCTSTR sLog)
{
    int         iItems;
    iItems = m_ListLog.GetItemCount();

    m_ListLog.InsertItem(iItems, sLog);
    m_ListLog.Update(iItems);
    m_ListLog.SetItemText(iItems, 0, sLog);
    m_ListLog.Update(iItems);
    UpdateData(FALSE);

    SetDlgItemText(IDC_STATIC, sLog);
}

I have a code like this to write install log to a static text and a list control, and i have a button to start the installer that be handle by function OnClickInstallBtn() but every time I call the WriteLogtoScreen(), only the static text change and nothing show up in the list until the OnClickInstallBtn() is done and everything on that list show up all at one.

How can i make it show up right away like the static text?

WriteLogtoScreen(LPCTSTR sLog)
{
    int         iItems;
    iItems = m_ListLog.GetItemCount();

    m_ListLog.InsertItem(iItems, sLog);
    m_ListLog.Update(iItems);
    m_ListLog.SetItemText(iItems, 0, sLog);
    m_ListLog.Update(iItems);
    UpdateData(FALSE);

    SetDlgItemText(IDC_STATIC, sLog);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清秋悲枫 2025-02-02 02:17:32

如果要在类似的内容中明确强制列表的重新划分,则应调用redrawwindow()

    void WriteLogtoScreen(LPCTSTR sLog)  
    {
            int      iItems;
            iItems = m_ListLog.GetItemCount();

            m_ListLog.InsertItem(iItems, sLog);
            m_ListLog.Update(iItems);
            m_ListLog.SetItemText(iItems, 0, sLog);
            m_ListLog.Update(iItems);
            UpdateData(FALSE);

            //instant redraw  
            m_ListLog.RedrawWindow();

            SetDlgItemText(IDC_STATIC, sLog);  
    }

You should call RedrawWindow() if you want to force the redraw of your list explicitly in something like this :

    void WriteLogtoScreen(LPCTSTR sLog)  
    {
            int      iItems;
            iItems = m_ListLog.GetItemCount();

            m_ListLog.InsertItem(iItems, sLog);
            m_ListLog.Update(iItems);
            m_ListLog.SetItemText(iItems, 0, sLog);
            m_ListLog.Update(iItems);
            UpdateData(FALSE);

            //instant redraw  
            m_ListLog.RedrawWindow();

            SetDlgItemText(IDC_STATIC, sLog);  
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文