| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 628 人关注过本帖
标题:进度条题目。。就帮忙。。
只看楼主 加入收藏
spyfay
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-6-15
结帖率:0
收藏
已结贴  问题点数:20 回复次数:3 
进度条题目。。就帮忙。。
如图所示为编程一个基于对话框程序界面,其中进度条已经定义了一个变量m_Progress,并且添加了“开始”按钮的响应函数OnStart()和WM_TIMER的消息响应函数:OnTimer(UINT nIDEvent).为实现如下功能,试编写相应程序代码。
1、    软件起动后,将进度条的范围设置成0到200,步长设成1,起始位置在0位;
2、    按开始按钮后,进度条位置值开始逐渐增加,20秒后过度条到达满值,然后停止。
3、    再次按开始按钮,动作重复

BOOLCTestDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
 
    // Add "About..." menu item tosystem menu.
 
    // IDM_ABOUTBOX must be in the systemcommand range.
    ASSERT((IDM_ABOUTBOX & 0xFFF0) ==IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000);
 
    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
        CString strAboutMenu;
        strAboutMenu.LoadString(IDS_ABOUTBOX);
        if (!strAboutMenu.IsEmpty())
        {
            pSysMenu->AppendMenu(MF_SEPARATOR);
            pSysMenu->AppendMenu(MF_STRING,IDM_ABOUTBOX, strAboutMenu);
        }
    }
 
    // Set the icon for this dialog.  The framework does this automatically
    // when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);         // Set big icon
    SetIcon(m_hIcon, FALSE);        // Set small icon
   
    //TODO: Add extra initialization here




return TRUE;  // return TRUE  unless you set the focus to a control
}
void CTestDlg::OnStart()
{
    // TODO: Add your control notificationhandler code here




voidCTestDlg::OnTimer(UINT nIDEvent)
{
    // TODO: Add your message handler code hereand/or call default




CDialog::OnTimer(nIDEvent);
}
搜索更多相关主题的帖子: 软件 如图所示 对话框 
2013-06-15 13:27
bczgvip
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:66
帖 子:1310
专家分:5312
注 册:2009-2-26
收藏
得分:7 
MFC?发错地方了吧,还有你这是作业吧。
2013-06-15 16:48
Artless
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:103
帖 子:4211
专家分:28888
注 册:2009-4-8
收藏
得分:7 
发错地方

无知
2013-06-15 19:04
ltp217
Rank: 2
等 级:论坛游民
帖 子:8
专家分:32
注 册:2013-6-4
收藏
得分:7 
BOOLCTestDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    // Add "About..." menu item tosystem menu.

    // IDM_ABOUTBOX must be in the systemcommand range.
    ASSERT((IDM_ABOUTBOX & 0xFFF0) ==IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000);

    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
        CString strAboutMenu;
        strAboutMenu.LoadString(IDS_ABOUTBOX);
        if (!strAboutMenu.IsEmpty())
        {
            pSysMenu->AppendMenu(MF_SEPARATOR);
            pSysMenu->AppendMenu(MF_STRING,IDM_ABOUTBOX, strAboutMenu);
        }
    }

    // Set the icon for this dialog.  The framework does this automatically
    // when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);         // Set big icon
    SetIcon(m_hIcon, FALSE);        // Set small icon
   
    //TODO: Add extra initialization here
     SetTimer(0,100,NULL);//设置定时器定时时间为100ms



return TRUE;  // return TRUE  unless you set the focus to a control
}
void CTestDlg::OnStart()
{
    // TODO: Add your control notificationhandler code here
   m_Progress.SetRange(0,200);//范围为0-200
    m_Progress.SetPos(0);//初始位置为0



voidCTestDlg::OnTimer(UINT nIDEvent)
{
    // TODO: Add your message handler code hereand/or call default
   m_Progress.SetStep(1);//每100ms前进一步,20S走完200步



CDialog::OnTimer(nIDEvent);
}
2013-06-17 14:44
快速回复:进度条题目。。就帮忙。。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013839 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved