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

A fast and lightweight cell control

Rate me:
Please Sign up or sign in to vote.
4.42/5 (31 votes)
11 Mar 2008CPOL1 min read 90.9K   4.5K   81  
A fast and lightweight cell control for displaying tabular data. The cell is a custom control derived from ATL::CWindow.
#pragma once
namespace mycell{
	class GridBase;
	/*
	class SelectionBound 
	{
		GridBase* pGrid_;
		RECT rcBound_;
	public:
		SelectionBound(GridBase* pGrid);
		BEGIN_MSG_MAP(SelectionBound)

		END_MSG_MAP()

	public:
		void Draw(HDC hDC,LPCRECT lprc);
		//void DrawErease(HDC hDC);
	private:
		//void DrawBound(HDC hDC,LPCRECT);
	};
	*/
	//-----------------------------------------------------------------//
	//�������ڱ��ֻѡ����ѡ��߽磬��һ��
	//ö��EOpType���ֶԻѡ���IJ���״̬���ֱ���
	//SOT_NOOP-�޲�����SOT_MOVE-�ƶ�������
	//SOT_SHRINK-����������SOT_EXPAND-���������
	//��bounds_�洢�ѡ�����������еķ�Χ��
	//-----------------------------------------------------------------//
	struct ActiveSelectionBounds
	{
		enum EOpType
		{
			SOT_NOOP=0,	//�޲���
			SOT_MOVE,		//�ƶ��ѡ�񼯺�
			SOT_SHRINK,	//�����ѡ�񼯺�
			SOT_EXPAND,	//����ѡ�񼯺�
		};
		ActiveSelectionBounds()
		{
		}
		ActiveSelectionBounds(EOpType optype):opType_((BYTE)optype)
		{}
		ActiveSelectionBounds(EOpType optype,const CCellRange& bounds):opType_(optype),bounds_(bounds)
		{
		}
		ActiveSelectionBounds(const ActiveSelectionBounds& rhs)
			:opType_(rhs.opType_),bounds_(rhs.bounds_)
		{
		}
		ActiveSelectionBounds& operator=(const ActiveSelectionBounds& rhs)
		{
			memcpy(this,&rhs,sizeof(ActiveSelectionBounds));
			return *this;
		}
		EOpType get_OpType()const
		{
			return (EOpType)opType_;
		}
		void put_OpType(EOpType optype)
		{
			opType_=(BYTE)optype;
		}
		const CCellRange& get_bounds()const
		{
			return bounds_;
		}
		void put_bounds(const CCellRange& bounds)
		{
			_ASSERT(bounds.IsNormalize());
			bounds_=bounds;
		}
	private:
		BYTE opType_;		//����EOpTypeֵ
		CCellRange bounds_;//
	};
}//namespace mycell

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
China China
My name is Yanxueming,i live in Chengdu China.Graduated from UESTC in 1999.

Comments and Discussions