狂easy,怎么强制刷新对话框,马上给分。。。

NothingRemained 2002-06-19 03:02:09
我点一个按钮后,想强制刷新对话框(有些edit控件内容被我改变了)..,该怎么办?

我用UpdateData(FALSE)、Onpaint都要等到我的函数执行完毕后,对话框才进行刷新,可是我想马上刷新,因为我的函数要运行很长一段时间。
...全文
1106 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
batizhou 2002-06-19
  • 打赏
  • 举报
回复
开线程,在线程里进行计算。得到结果后马上发消息给主窗口,主窗口处理消息并显示内容。
Rodgu 2002-06-19
  • 打赏
  • 举报
回复
同意开线程的方法
bcb_fans 2002-06-19
  • 打赏
  • 举报
回复
1、使用函数RedrawWindow().

2、直接想对话框发送WM_PAINT消息。
nuaawyd 2002-06-19
  • 打赏
  • 举报
回复
楼上说得比较全
bcb_fans 2002-06-19
  • 打赏
  • 举报
回复
1、使用函数RedrawWindow().

2、直接想对话框发送WM_PAINT消息。
Kerrie 2002-06-19
  • 打赏
  • 举报
回复
UpdateData(FALSE)也得调用的,还是抄袭!:)

如果你要修改一项编辑框的内容,做法如下
UpdateData(TRUE) //保存当前控件变量内容
m_strText = "ABC" // m_strText为编辑框绑定变量,修改变量值
UpdateData(FALSE) // 刷新控件变量
上面的代码如果等同于下面一句
m_wndEdit.SetWindowText("abc");

不过这而对话框可能还没有开始刷新能
Invalidate(); // 设置整个对话框为无效区域
UpdateWindow(); // 强制窗口立刻刷新

this' all
Kerrie 2002-06-19
  • 打赏
  • 举报
回复
先Invalidate
然后UpdateWindow
呵呵,抄袭了?
qunta 2002-06-19
  • 打赏
  • 举报
回复
CWnd::UpdateWindow()
UpdateWindow Updates the client area by sending a WM_PAINT message if the update region is not empty. The UpdateWindow member function sends a WM_PAINT message directly, bypassing the application queue.
Jakecat 2002-06-19
  • 打赏
  • 举报
回复
CWnd::Invalidate
void Invalidate( BOOL bErase = TRUE );

Parameters

bErase

Specifies whether the background within the update region is to be erased.

Remarks

Invalidates the entire client area of CWnd. The client area is marked for painting when the next WM_PAINT message occurs. The region can also be validated before a WM_PAINT message occurs by the ValidateRect or ValidateRgn member function.

The bErase parameter specifies whether the background within the update area is to be erased when the update region is processed. If bErase is TRUE, the background is erased when the BeginPaint member function is called; if bErase is FALSE, the background remains unchanged. If bErase is TRUE for any part of the update region, the background in the entire region, not just in the given part, is erased.

Windows sends a WM_PAINT message whenever the CWnd update region is not empty and there are no other messages in the application queue for that window.

及相关函数
storein 2002-06-19
  • 打赏
  • 举报
回复
你的目的是使内容立刻显示出来
那么线程是最好的方法
kingofvc 2002-06-19
  • 打赏
  • 举报
回复
SetWindowText
volcary 2002-06-19
  • 打赏
  • 举报
回复
把你的函数写在一个线程中就可以了
kingofvc 2002-06-19
  • 打赏
  • 举报
回复
SetWindowText
TopLevel 2002-06-19
  • 打赏
  • 举报
回复
Invalidate(TRUE)
常宁 2002-06-19
  • 打赏
  • 举报
回复
楼上的是不是写错了?updatedata(true)是用来同步数据的(得到)
应该用updatadata(false)来刷新
如果你打算实现你的功能,我看你最好用控件变量,不要用CString之类的
small_wei 2002-06-19
  • 打赏
  • 举报
回复
UpdateData(true)

16,470

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧