Click here to Skip to main content
15,884,176 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
#include <map>
#include <list>
#include <atlstr.h>
#include "ColorTable.h"
using namespace std;
namespace mycell{
	/*
	template<class T>
	class FontsMgr
	{
		//typedef pair<FontDesc,int> ref_font_pair_t;//second is ref
		//list<ref_font_pair_t*> fontsList_;
		//map<int,map<int,ref_font_pair_t*>*> mapFont_;
		//CComPtr<IFont> pDefFont_;//Ĭ������
		//FontDesc defFontDesc_;
	public:
		FontsMgr()
		{
			//defFontDesc_.name=_T("����");
			//defFontDesc_.cySize.Hi=0;
			//defFontDesc_.cySize.Lo=9*10000;
			//defFontDesc_.sCharset=GB2312_CHARSET;
			//defFontDesc_.sWeight=FW_NORMAL;
			//FONTDESC _fontDesc=
			//{
			//	sizeof(FONTDESC),OLESTR("����"),
			//	FONTSIZE(9),FW_NORMAL,
			//	GB2312_CHARSET,FALSE,FALSE,FALSE
			//};
			//HRESULT hr=OleCreateFontIndirect(&_fontDesc,IID_IFont,(void**)&pDefFont_);
			//_ASSERT(SUCCEEDED(hr));
		}
		//~FontsMgr();
	public:
		//BOOL GetCellFont(int row,int col,FontDesc& fontDesc)
		//{
		//	T const* pT=static_cast<T const*>(this);
		//	StyleDesc styleDesc;
		//	if(pT->GetCellStyle(row,col,styleDesc)){
		//		fontDesc=styleDesc.fontDesc;
		//		return TRUE;
		//	}else{
		//		fontDesc.SetNull();
		//		return FALSE;
		//	}
		//}
		void SetCellFont(int row,int col,FontDesc fontDesc)
		{
			T* pT=static_cast<T*>(this);
			StyleDesc styleDesc;
			pT->GetCellStyle(row,col,styleDesc);
			styleDesc.fontDesc=fontDesc;
			pT->SetCellStyle(row,col,styleDesc);
		}
		//FontDesc GetDefaultFont()const
		//{
		//	return defFontDesc_;
		//}
		//void SetDefaultFont(FontDesc const& fontDesc)
		//{
		//	defFontDesc_=fontDesc;
		//}
	//public:
	//	void OnRowDelete(int beg,int end)
	//	{
	//	}
	//	void OnRowInsertFront(int row,int nCount)
	//	{
	//	}
	//	void OnColDelete(int beg,int end)
	//	{
	//	}
	//	void OnColInsertFront(int col,int nCount)
	//	{
	//	}
	};
	*/
}//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