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

📄 otherdataview.cpp

📁 这是一个3D彩票统计查询方面的一个软件
💻 CPP
字号:
// OtherDataView.cpp : implementation file
//

#include "stdafx.h"
#include "3d.h"
#include "OtherDataView.h"

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

/////////////////////////////////////////////////////////////////////////////
// COtherDataView
#define TipsPerPixel 15
static CString m_ColHead[] = 
{
	"期数", 
	"机号", 
	"球号", 
	"试机号", 
	"实际号", 
	"  ","0","1","2","3","4","5","6","7","8","9", 
	"  ","0","1","2","3","4","5","6","7","8","9",  
	"  ","0","1","2","3","4","5","6","7","8","9", 
	"  ",
	"试机和",
	"实际和"
};




IMPLEMENT_DYNCREATE(COtherDataView, CFormView)

COtherDataView::COtherDataView()
	: CFormView(COtherDataView::IDD)
{
	//{{AFX_DATA_INIT(COtherDataView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

COtherDataView::~COtherDataView()
{
}

void COtherDataView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(COtherDataView)
	DDX_Control(pDX, IDC_MSFLEXGRID1, m_RTGrid);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(COtherDataView, CFormView)
	//{{AFX_MSG_MAP(COtherDataView)
	ON_WM_SIZE()
	ON_THREAD_MESSAGE(WM_DISPDATA,OnDispData)
	ON_WM_MOUSEWHEEL()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// COtherDataView diagnostics

#ifdef _DEBUG
void COtherDataView::AssertValid() const
{
	CFormView::AssertValid();
}

void COtherDataView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// COtherDataView message handlers

void COtherDataView::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	MoveWindows();


	m_RTGrid.SetColWidth(0, 20  * TipsPerPixel);
	m_RTGrid.SetColWidth(1, 70  * TipsPerPixel);
	m_RTGrid.SetColWidth(2, 30  * TipsPerPixel);
	m_RTGrid.SetColWidth(3, 30 * TipsPerPixel);
	m_RTGrid.SetColWidth(4, 50 * TipsPerPixel);
	m_RTGrid.SetColWidth(5, 50  * TipsPerPixel);

	m_RTGrid.SetColWidth(6,10  * TipsPerPixel);
	for(int i=0;i<10;i++)
		m_RTGrid.SetColWidth(i+7, 20  * TipsPerPixel);
	
	m_RTGrid.SetColWidth(17, 10  * TipsPerPixel);
	for(i=0;i<10;i++)
		m_RTGrid.SetColWidth(i+18, 20  * TipsPerPixel);
	
	m_RTGrid.SetColWidth(28, 10  * TipsPerPixel);
	for(i=0;i<10;i++)
		m_RTGrid.SetColWidth(i+29, 20  * TipsPerPixel);
	
	m_RTGrid.SetColWidth(39, 10  * TipsPerPixel);
	m_RTGrid.SetColWidth(40, 50  * TipsPerPixel);
	m_RTGrid.SetColWidth(41, 50  * TipsPerPixel);

	InitGridHead();

	// TODO: Add your specialized code here and/or call the base class
	
}

//初始化GridHead
void COtherDataView::InitGridHead()
{
	long Cols = m_RTGrid.GetCols();
	m_RTGrid.SetColAlignment(0, 4); // center alignment
	for(long col = 1; col <Cols; col ++)
	{
		m_RTGrid.SetColAlignment(col, 4);
		m_RTGrid.SetTextMatrix(0, col, m_ColHead[col-1]);
	}
}



void COtherDataView::MoveWindows()
{
	CRect rect;
	GetClientRect(rect);
	m_RTGrid.MoveWindow(rect);
}


void COtherDataView::RedrawGrid(L3DDATAOTHER myotherdata,UINT urow)
{
	CString str;
	m_RTGrid.SetRow(urow);


	// column 0 : index
	str.Format("%d", urow);
	m_RTGrid.SetTextMatrix(urow, 0, str);

	// column 1 : 期数
	str = "";
	str.Format("%d", myotherdata.uItemNo);
	m_RTGrid.SetTextMatrix(urow, 1, str);

	// column 2 : 机号
	str = "";
	str.Format("%d", myotherdata.uJNo);
	m_RTGrid.SetTextMatrix(urow, 2, str);

	// column 3 : 球号
	str = "";
	str.Format("%d", myotherdata.uQNo);
	m_RTGrid.SetTextMatrix(urow, 3, str);
	
	// column 4 : 试机号
	m_RTGrid.SetCol(4);
	m_RTGrid.SetCellBackColor(RGB(200,50,50));
	m_RTGrid.SetCellForeColor(RGB(255,255,255));
	m_RTGrid.SetTextMatrix(urow, 4,myotherdata.strsjbsg);

	// column 5 : 实际号
	m_RTGrid.SetCol(5);
	m_RTGrid.SetCellBackColor(RGB(50,50,200));
	m_RTGrid.SetCellForeColor(RGB(255,255,255));
	m_RTGrid.SetTextMatrix(urow,5,myotherdata.strbsg);

	// column 6 : 分隔栏
	m_RTGrid.SetCol(6);
	m_RTGrid.SetCellBackColor(RGB(150,150,150));
	for(int i=0;i<10;i++)
	{
		str = "";
		if((i == myotherdata.uSJBNo) && (i != myotherdata.uBNo))
		{
			str.Format("%d",i);
			
			m_RTGrid.SetCol(i+7);
			m_RTGrid.SetCellBackColor(RGB(255,0,0));
			m_RTGrid.SetCellForeColor(RGB(255,255,255));
			m_RTGrid.SetTextMatrix(urow,i+7, str);
		}
		else   if((i == myotherdata.uBNo) && (i != myotherdata.uSJBNo)) 
		{
			str.Format("%d",i);
			
			m_RTGrid.SetCol(i+7);
			m_RTGrid.SetCellBackColor(RGB(0,0,255));
			m_RTGrid.SetCellForeColor(RGB(255,255,255));
			m_RTGrid.SetTextMatrix(urow,i+7, str);
		}
		else if((i == myotherdata.uBNo) && (i == myotherdata.uSJBNo) )
		{
			str.Format("%d",i);
			
			m_RTGrid.SetCol(i+7);
			m_RTGrid.SetCellBackColor(RGB(0,255,0));
			m_RTGrid.SetCellForeColor(RGB(255,255,255));
			m_RTGrid.SetTextMatrix(urow,i+7, str);
		}
		else
			m_RTGrid.SetTextMatrix(urow,i+7, str);
	}

	// column 17 : 分隔栏
	m_RTGrid.SetCol(17);
	m_RTGrid.SetCellBackColor(RGB(150,150,150));
	for(i=0;i<10;i++)
	{
		str = "";
		if((i == myotherdata.uSJSNo) && (i != myotherdata.uSNo))
		{
			str.Format("%d",i);
			
			m_RTGrid.SetCol(i+18);
			m_RTGrid.SetCellBackColor(RGB(255,0,0));
			m_RTGrid.SetCellForeColor(RGB(255,255,255));
			m_RTGrid.SetTextMatrix(urow,i+18, str);
		}
		else   if((i == myotherdata.uSNo) && (i != myotherdata.uSJSNo)) 
		{
			str.Format("%d",i);
			
			m_RTGrid.SetCol(i+18);
			m_RTGrid.SetCellBackColor(RGB(0,0,255));
			m_RTGrid.SetCellForeColor(RGB(255,255,255));
			m_RTGrid.SetTextMatrix(urow,i+18, str);
		}
		else if((i == myotherdata.uSNo) && (i == myotherdata.uSJSNo) )
		{
			str.Format("%d",i);
			
			m_RTGrid.SetCol(i+18);
			m_RTGrid.SetCellBackColor(RGB(0,255,0));
			m_RTGrid.SetCellForeColor(RGB(255,255,255));
			m_RTGrid.SetTextMatrix(urow,i+18, str);
		}
		else
			m_RTGrid.SetTextMatrix(urow,i+18, str);
	}

	// column 28 : 分隔栏
	m_RTGrid.SetCol(28);
	m_RTGrid.SetCellBackColor(RGB(150,150,150));
	for(i=0;i<10;i++)
	{
		str = "";
		if((i == myotherdata.uSJGNo) && (i != myotherdata.uGNo))
		{
			str.Format("%d",i);
			
			m_RTGrid.SetCol(i+29);
			m_RTGrid.SetCellBackColor(RGB(255,0,0));
			m_RTGrid.SetCellForeColor(RGB(255,255,255));
			m_RTGrid.SetTextMatrix(urow,i+29, str);
		}
		else   if((i == myotherdata.uGNo) && (i != myotherdata.uSJGNo)) 
		{
			str.Format("%d",i);
			
			m_RTGrid.SetCol(i+29);
			m_RTGrid.SetCellBackColor(RGB(0,0,255));
			m_RTGrid.SetCellForeColor(RGB(255,255,255));
			m_RTGrid.SetTextMatrix(urow,i+29, str);
		}
		else if((i == myotherdata.uGNo) && (i == myotherdata.uSJGNo) )
		{
			str.Format("%d",i);
			
			m_RTGrid.SetCol(i+29);
			m_RTGrid.SetCellBackColor(RGB(0,255,0));
			m_RTGrid.SetCellForeColor(RGB(255,255,255));
			m_RTGrid.SetTextMatrix(urow,i+29, str);
		}
		else
			m_RTGrid.SetTextMatrix(urow,i+29, str);
	}


	// column 39 : 分隔栏
	m_RTGrid.SetCol(39);
	m_RTGrid.SetCellBackColor(RGB(150,150,150));
	// column 40 : 试机号和值
	m_RTGrid.SetCol(40);
	m_RTGrid.SetCellBackColor(RGB(200,50,50));
	m_RTGrid.SetCellForeColor(RGB(255,255,255));
	str = "";
	str.Format("%2d",myotherdata.uSJCount);
	m_RTGrid.SetTextMatrix(urow,40, str);

	// column 41 : 实际号和值
	m_RTGrid.SetCol(41);
	m_RTGrid.SetCellBackColor(RGB(50,50,200));
	m_RTGrid.SetCellForeColor(RGB(255,255,255));
	str = "";
	str.Format("%2d", myotherdata.uCountValue );
	m_RTGrid.SetTextMatrix(urow,41, str);
}

void COtherDataView::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);

	if(::IsWindow(m_RTGrid.m_hWnd))
		MoveWindows();	
	
}


void COtherDataView::OnDispData(WPARAM wparam,LPARAM lparam)
{
	//在本次显示之前先清除上次的显示内容
	m_RTGrid.Clear();
	InitGridHead();

	L3DOTHERARRAY* parray = new L3DOTHERARRAY;
	parray = (L3DOTHERARRAY*)wparam;
	L3DDATAOTHER*  m_pdata = new L3DDATAOTHER;
	
	int ncount = parray->GetSize();
	CString strtmp = "";
	//设置数据控件的行数
	m_RTGrid.SetRows(ncount+1);
	for(int i=1;i<=ncount;i++)
		RedrawGrid(parray->GetAt(i-1),i);

	parray->RemoveAll();
}

BOOL COtherDataView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) 
{
	// TODO: Add your message handler code here and/or call default
	//m_RTGrid.SetScrollPos(SB_VERT,50);
	//AfxMessageBox("ddd");
	return CFormView::OnMouseWheel(nFlags, zDelta, pt);
}

⌨️ 快捷键说明

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