关于进度条创建疑问

sc_valentine21 2008-11-19 03:49:46
直接拖了一个CProgressCtrl控件到dialog上,IDC_PROGRESS1,现在什么都没做,我要她有进度变化,要怎么做?怎么才能与这个ID相关联呢?是不是 m_progress.SetRange(0,100);
m_progress.SetStep(1);

m_progress.UpdateWindow();
这样就会行?
...全文
89 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
sc_valentine21 2008-11-20
  • 打赏
  • 举报
回复
ok
关键在Updatedata(FALSE);
sc_valentine21 2008-11-20
  • 打赏
  • 举报
回复
我类向导生成CString m_text;然后在OnInitDialog给m_text赋值,然而运行的时候没有显示。
如果我将其设置成CStatic m_text;然后m_text.SetWindowText( "1232" );这样就能显示,这是
为什么?
我看到有的程序按第一种也可以实现啊????
华亭真人 2008-11-19
  • 打赏
  • 举报
回复
不用这么麻烦,右键点那个控件,选类向导,增加变量就可以了
lwx300 2008-11-19
  • 打赏
  • 举报
回复
先为静态文本设置一个新的ID值,然后SetDlgItemText(IDC_MYSTATIC, _T("显示的内容"));
sc_valentine21 2008-11-19
  • 打赏
  • 举报
回复
那个已经搞定了,现在我建了一个静态文本,咋让它显示我给的内容?
oakfire 2008-11-19
  • 打赏
  • 举报
回复
在你的dialog里的DoDataExchange(CDataExchange* pDX)函数里添加一行
DDX_Control(pDX, IDC_PROGRESS1, m_progress);
sc_valentine21 2008-11-19
  • 打赏
  • 举报
回复
CProgressCtrl m_progress;

这个m_progress怎么与拖动建的ID关系起来?
lwx300 2008-11-19
  • 打赏
  • 举报
回复
先设置控件的范围、初始位置、步长:
m_progress.SetRange32(0, 100);
m_progress.SetPos(0);
m_progress.SetStep(1);

//然后使用
m_progress.StepIt() 或 m_progress.SetPos(int nPos); 更新进度。
zoulie 2008-11-19
  • 打赏
  • 举报
回复
简单点的设个定时器
然后再ONTIME 里调用你上面写的
samuellei 2008-11-19
  • 打赏
  • 举报
回复
There are three ways to change the current position of a progress control (CProgressCtrl).

The position can be changed by a preset increment amount.


The position can be changed by an arbitrary amount.


The position can be changed to a specific value.
To change the position by a preset amount

Use theSetStep member function to set the increment amount. By default, this value is 10. This value is typically set as one of the initial settings for the control. The step value can be negative.


Use theStepIt member function to increment the position. This causes the control to redraw itself.
Note StepIt will cause the position to wrap. For example, given a range of 1 – 100, a step of 20, and a position of 90, StepIt will set the position to 10.

To change the position by an arbitrary amount

Use theOffsetPos member function to change the position. OffsetPos will accept negative values.
Note OffsetPos, unlike StepIt, will not wrap the position. The new position is adjusted to remain within the range.

To change the position to a specific value

Use theSetPos member function to set the position to a specific value. If necessary, the new position is adjusted to be within the range.

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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