Click here to Skip to main content
15,886,199 members
Articles / Desktop Programming / MFC

The ALXGrid Control Library.

Rate me:
Please Sign up or sign in to vote.
5.00/5 (29 votes)
10 Nov 20021 min read 200.5K   5.5K   85  
The ALXGrid Control Library is a set of classes for management of data as a table.
// EventGrig.cpp : implementation file
//

#include "stdafx.h"
#include "Grid.h"
#include "CrGridCtrl.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEventGrig

IMPLEMENT_DYNCREATE(CCrGridCtrl, CALXGridCtrl)

BEGIN_MESSAGE_MAP(CCrGridCtrl, CALXGridCtrl)
	//{{AFX_MSG_MAP(CCrGridCtrl)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

CCrGridCtrl::CCrGridCtrl()
{
/*
	DefineColCtrl(AddCol(50,"�", ACFF_RIGHT, AHFF_LEFT),GA_EDITCTRL,WS_CHILD | ES_RIGHT | ES_AUTOHSCROLL);
	DefineImage(0,7,7);
	DefineColCtrl(AddCol(180,"Text", ACFF_LEFT, AHFF_LEFT),GA_EDITCTRL,WS_CHILD | ES_LEFT | ES_AUTOHSCROLL);
	DefineColCtrl(AddCol(75,"Data", ACFF_CENTER, AHFF_CENTER),GA_EDITCTRL,WS_CHILD | ES_CENTER | ES_AUTOHSCROLL);
	DefineColCtrl(AddCol(75,"Nom", ACFF_RIGHT, AHFF_RIGHT),GA_EDITCTRL,WS_CHILD | ES_RIGHT | ES_AUTOHSCROLL);
	DefineColCtrl(AddCol(200,"Name1", ACFF_LEFT, AHFF_LEFT),GA_EDITCTRL,WS_CHILD | ES_LEFT | ES_AUTOHSCROLL);
	DefineColCtrl(AddCol(200,"Name2", ACFF_LEFT, AHFF_LEFT),GA_EDITCTRL,WS_CHILD | ES_LEFT | ES_AUTOHSCROLL);
	SetGridRowCount(100);
	m_BMP.LoadBitmap(IDB_BITMAP);
*/
	DefineColCtrl(AddCol(50,"�", ACFF_RIGHT, AHFF_LEFT),GA_CELLCTRL,WS_CHILD | ES_RIGHT | ES_AUTOHSCROLL);
	DefineImage(0,7,7);
	DefineColCtrl(AddCol(180,"Text", ACFF_LEFT, AHFF_LEFT),GA_CELLCTRL,WS_CHILD | ES_LEFT | ES_AUTOHSCROLL);
	DefineColCtrl(AddCol(75,"Data", ACFF_CENTER, AHFF_CENTER),GA_CELLCTRL,WS_CHILD | ES_CENTER | ES_AUTOHSCROLL);
	DefineColCtrl(AddCol(75,"Nom", ACFF_RIGHT, AHFF_RIGHT),GA_CELLCTRL,WS_CHILD | ES_RIGHT | ES_AUTOHSCROLL);
	DefineColCtrl(AddCol(200,"Name1", ACFF_LEFT, AHFF_LEFT),GA_CELLCTRL,WS_CHILD | ES_LEFT | ES_AUTOHSCROLL);
	DefineColCtrl(AddCol(200,"Name2", ACFF_LEFT, AHFF_LEFT),GA_CELLCTRL,WS_CHILD | ES_LEFT | ES_AUTOHSCROLL);
	SetGridRowCount(100);
	m_BMP.LoadBitmap(IDB_BITMAP);

}

CCrGridCtrl::~CCrGridCtrl()
{
}

CELL_DATA CCrGridCtrl::GetCellData(int nCol, int nRow)
{
	CELL_DATA CellData = CALXGrid::GetCellData(nCol,nRow);
	switch(nCol)
	{
	case 0:
		{
			CellData.m_strText.Format("%u",nRow+1866+nRow*5/3);
			break;
		}
	case 1:
		{
			CellData.m_strText = "Sampl";
			break;
		}
	case 2:
		{
			CellData.m_strText.Format("%u.%u.%u",11,11,2000);
			break;
		}
	case 3:
		{
			CellData.m_strText.Format("%u",nRow*nCol+44*nCol+56*nRow-nCol*33-nRow*3+500);
			break;
		}
	case 4:
		{
			CellData.m_strText = "Robson";
			break;
		}
	case 5:
		{
			CellData.m_strText = "Simpson";
			break;
		}
	default:
		CellData.m_strText.Format("%u - %u",nCol,nRow);
	}
	return CellData;
}

LPARAM CCrGridCtrl::GetImage(int nCol, int nRow, BOOL bSelected)
{
	return (LPARAM)(HBITMAP)m_BMP;
}
/////////////////////////////////////////////////////////////////////////////
// CCrGridCtrl message handlers

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Russian Federation Russian Federation
Year of birth - 1974.
Eeducation - was ended by Kaliningrad State University in 1997.
Now I work as the engineer-programmer in Kaliningrad (RUSSIA).

Comments and Discussions