⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 renshou1view.cpp

📁 抽奖号码滚动模拟程序,线程实现抽奖号码滚动界面
💻 CPP
字号:
// renshou1View.cpp : implementation of the CRenshou1View class
//

#include "stdafx.h"
#include "renshou1.h"

#include "renshou1Set.h"
#include "renshou1Doc.h"
#include "renshou1View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CRenshou1View

IMPLEMENT_DYNCREATE(CRenshou1View, CRecordView)

BEGIN_MESSAGE_MAP(CRenshou1View, CRecordView)
	//{{AFX_MSG_MAP(CRenshou1View)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRenshou1View construction/destruction

CRenshou1View::CRenshou1View()
	: CRecordView(CRenshou1View::IDD)
{
	//{{AFX_DATA_INIT(CRenshou1View)
	m_pSet = NULL;
	m_num = 0;
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CRenshou1View::~CRenshou1View()
{
}

void CRenshou1View::DoDataExchange(CDataExchange* pDX)
{
	CRecordView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CRenshou1View)
	DDX_Control(pDX, IDC_LIST2, m_list2);
	DDX_Control(pDX, IDC_LIST1, m_list1);
	DDX_Text(pDX, IDC_EDIT1, m_num);
	//}}AFX_DATA_MAP
}

BOOL CRenshou1View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CRecordView::PreCreateWindow(cs);
}

void CRenshou1View::OnInitialUpdate()
{
	m_pSet = &GetDocument()->m_renshou1Set;
	CRecordView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();
	m_pSet->MoveFirst();

}

/////////////////////////////////////////////////////////////////////////////
// CRenshou1View printing

BOOL CRenshou1View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CRenshou1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CRenshou1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CRenshou1View diagnostics

#ifdef _DEBUG
void CRenshou1View::AssertValid() const
{
	CRecordView::AssertValid();
}

void CRenshou1View::Dump(CDumpContext& dc) const
{
	CRecordView::Dump(dc);
}

CRenshou1Doc* CRenshou1View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CRenshou1Doc)));
	return (CRenshou1Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CRenshou1View database support
CRecordset* CRenshou1View::OnGetRecordset()
{
	return m_pSet;
}


/////////////////////////////////////////////////////////////////////////////
// CRenshou1View message handlers

void CRenshou1View::OnButton1() 
{
	// TODO: Add your control notification handler code here
	//m_pSet->MoveFirst();
	m_stop=true;
	//int nIndex=m_list1.AddString(m_pSet->m_ID);
   //while(!m_pSet->IsEOF() && m_stop)
    //while(!m_pSet->IsEOF())
	//for(int j=1;j<1000;j++)
	//{
	     m_timer=SetTimer(1,1,NULL);
         //m_timer1=SetTimer(2,500,NULL);
		/*m_pSet->MoveNext();
    int nIndex=m_list2.AddString(m_pSet->m_ID);
	*/
		//}
}



void CRenshou1View::OnButton2() 
{
	// TODO: Add your control notification handler code here
             int cursel=m_list1.GetCurSel();
			 CString str;
			 str.Format("%d",m_num);
			 m_list1.GetText(cursel,str);
			 //temp_id.Format("%s",temp_id);
			 //m_pSet.m_strFilter="ID=temp_id";
			 //m_pSet.Requery();
			 m_num=cursel;
			 UpdateData(FALSE);
	m_stop=false;
	KillTimer(m_timer);
}

void CRenshou1View::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	//CString temp_id;
	//if(nIDEvent==1)
	//{
	if (!m_pSet->IsEOF() && m_stop)
	{
		int nIndex=m_list1.AddString(m_pSet->m_ID);
     	m_pSet->MoveNext();
        
	}
	//}
	//else 
		//if(nIDEvent==2)
		//{
			
		//}
	CRecordView::OnTimer(nIDEvent);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -