zoukankan      html  css  js  c++  java
  • VC:其他控件(CProgressCtrl、CScrollBar、CDateTimeCtrl、CMonthCalCtrl)

    1、进度条

           m_progressCtrl.SetRange(0,100);

           for(int i=0;i<100;i++)

           {

                  m_progressCtrl.SetPos(i);

                  Sleep(100);

           }

           AfxMessageBox("进度条到达终点");

    2、滑块控件:添加WM_VSCROLL消息。

    void COtherCtrlDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)

    {

           // TODO: Add your message handler code here and/or call default

           m_SliderCtrl.SetRange(0,100);

           CString str;

           str.Format("%d",m_SliderCtrl.GetPos());

           SetDlgItemText(IDC_EDIT1,str);

           CDialog::OnHScroll(nSBCode, nPos, pScrollBar);

    }

    3、时间控件:添加MCN_SELECT、或MCN_SELCHANGE消息映射

           1)CDateTimeCtrl:

           void COtherCtrlDlg::OnSelectMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult)

           {

                  // TODO: Add your control notification handler code here

                  CString str;

                  SYSTEMTIME time;

                  m_date.GetCurSel(&time);

                  str.Format("%d年 %d月 %d 日  星期%d",time.wYear,time.wMonth,time.wDay,time.wDayOfWeek);

                  AfxMessageBox(str);

                  *pResult = 0;

           }

           2)CMonthCalCtrl:

           void COtherCtrlDlg::OnCloseupDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult)

           {

                  // TODO: Add your control notification handler code here

                  CString str;

                  SYSTEMTIME time;

                  m_time.GetTime(&time);

                  //m_date.GetCurSel(&time);

                  str.Format("%d年 %d月 %d 日  星期%d",time.wYear,time.wMonth,time.wDay,time.wDayOfWeek);

                  m_date.SetCurSel(&time);

                  AfxMessageBox(str);

                  *pResult = 0;

           }

  • 相关阅读:
    loj1201(最大独立集)
    hdu4185+poj3020(最大匹配+最小边覆盖)
    【Leetcode】3Sum Closest
    【Leetcode】3Sum
    【Leetcode】Two Sum
    【Leetcode】Longest Consecutive Sequence
    【Leetcode】Median of Two Sorted Arrays
    【Leetcode】Search in Rotated Sorted Array II
    【Leetcode】Search in Rotated Sorted Array
    【Leetcode】Remove Duplicates from Sorted Array II
  • 原文地址:https://www.cnblogs.com/shenchao/p/2728640.html
Copyright © 2011-2022 走看看