123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- // TodayFormChild.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "TodayFormChild.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // TodayFormChild dialog
- TodayFormChild::TodayFormChild(CWnd* pParent /*=NULL*/)
- : CDialog(TodayFormChild::IDD, pParent)
- {
- //{{AFX_DATA_INIT(TodayFormChild)
- // NOTE: the ClassWizard will add member initialization here
- List1array=NULL;
- pClientarray=NULL;
- pTxtypearray=NULL;
- //}}AFX_DATA_INIT
- }
- void TodayFormChild::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(TodayFormChild)
- DDX_Control(pDX, IDC_SCROLLBAR1, m_vScroll);
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(TodayFormChild, CDialog)
- //{{AFX_MSG_MAP(TodayFormChild)
- //}}AFX_MSG_MAP
- ON_WM_VSCROLL()
- ON_WM_MOUSEWHEEL()
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // TodayFormChild message handlers
- void TodayFormChild::OnOK()
- {
- // TODO: Add extra validation here
-
- }
- void TodayFormChild::OnCancel()
- {
- // TODO: Add extra cleanup here
-
- }
- BOOL TodayFormChild::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- // 显示滚动条;
- GetClientRect(rt_mvScroll);
- SCROLLINFO si;
- si.cbSize = sizeof(SCROLLINFO);;
- si.nMin = 0;
- si.nMax = 100;
- si.nPage = 5 ;
- si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE;
- m_vScroll.SetScrollInfo(&si, TRUE);
- m_vScroll.GetWindowRect(rt_mvScroll);//滚动条所在的位置
- ScreenToClient(rt_mvScroll);
- m_vScroll.SetScrollRange(0, 256 * 10);
- m_vScroll.SetScrollPos(0);
- return TRUE;
- }
- void TodayFormChild::ShowTable()
- {
- CRect rc;
- GetClientRect(rc);
- m_table.m_pClientArray=pClientarray;
- m_table.pTxtypearray=pTxtypearray;
- m_table.m_pListArray=List1array;
-
- rt_mvScroll = rc;
- //rt_mvScroll.right -= 20;
- rt_mvScroll.left = rt_mvScroll.right - 20;
- rt_mvScroll.bottom -= 256 * 19 - 30;
- m_vScroll.MoveWindow(rt_mvScroll);
- rc.right -= 20;
- if(m_table.GetSafeHwnd()==NULL)
- m_table.Create(rc, this, WS_HSCROLL);
- m_table.Test ();
- }
- void TodayFormChild::DeleteCur()
- {
- m_table.DeleteCur();
- }
- void TodayFormChild::OtherDate()
- {
- m_table.OtherDate();
- }
- CString TodayFormChild::GetCurPhone(CString &name)
- {
- return m_table.GetCurPhone(name);
- }
- void TodayFormChild::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
- {
- // TODO: 在此添加消息处理程序代码和/或调用默认值
- SCROLLINFO si;
- si.cbSize = sizeof(si);
- m_vScroll.GetScrollInfo(&si, SIF_POS|SIF_PAGE|SIF_RANGE);
- nVscroll = si.nPos;
- switch(nSBCode)
- {
- case SB_LINEDOWN: nVscroll += 10;
- if (nVscroll > (si.nMax - si.nMin - si.nPage ))
- {
- nVscroll = si.nMax - si.nMin - si.nPage;
- }
- break;
- case SB_LINEUP: nVscroll -= 10;
- if (nVscroll < si.nMin)
- {
- nVscroll = 0;
- }
- break;
- case SB_PAGEDOWN: nVscroll += si.nPage;
- if (nVscroll > (si.nMax - si.nMin - si.nPage))
- {
- nVscroll = si.nMax - si.nMin - si.nPage;
- }
- break;
- case SB_PAGEUP: nVscroll -= si.nPage;
- if (nVscroll < si.nMin)
- {
- nVscroll = 0;
- }
- break;
- case SB_THUMBTRACK: nVscroll = nPos; break;
- }
- ScrollWindow(0, -(nVscroll -si.nPos) , NULL ,NULL);
- m_vScroll.MoveWindow(rt_mvScroll, TRUE);
- si.fMask = SIF_POS;
- si.nPos = nVscroll;
- m_vScroll.SetScrollInfo(&si, TRUE);
- CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
- }
- BOOL TodayFormChild::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
- {
- // TODO: 在此添加消息处理程序代码和/或调用默认值
- //向下滚
- if (zDelta == -120)
- {
- nVscroll += 10;
- OnVScroll(SB_PAGEDOWN, nVscroll, &m_vScroll);
- }
- else if (zDelta == 120)
- {
- nVscroll -= 10;
- OnVScroll(SB_PAGEUP, nVscroll, &m_vScroll);
- }
- m_vScroll.MoveWindow(rt_mvScroll, TRUE);
- return CDialog::OnMouseWheel(nFlags, zDelta, pt);
- }
|