Click here to Skip to main content
15,885,366 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.
// MyCell - version 1.1
// Written by Yanxueming <yanxm2003@hotmail.com>
// Copyright (C) 2006-2007
// All rights reserved.
//
// The code and information is provided "as-is" without
// warranty of any kind, either expressed or implied.
#include "stdafx.h"
#include "../include/CrossCursor.h"
namespace mycell{
	CrossCursor::CrossCursor(HINSTANCE hinst)
	{
		BYTE ANDmaskCursor[32][4];
		BYTE XORmaskCursor[32][4];
		for(int i=0;i<32;++i){
			for(int j=0;j<4;++j){
				ANDmaskCursor[i][j]=0xFF;
				XORmaskCursor[i][j]=0x0;
				if(1==i || 14==i){
					ANDmaskCursor[i][0]=0xFC;
					XORmaskCursor[i][0]=0x3;
					ANDmaskCursor[i][1]=0x3F;
					XORmaskCursor[i][1]=0xC0;
				}else if(i>=2 && i<=5 || i>=10 && i<=13){// in(2,3,4,5,10,11,12,13)
					ANDmaskCursor[i][0]=0xFC;
					XORmaskCursor[i][0]=0x2;
					ANDmaskCursor[i][1]=0x3F;
					XORmaskCursor[i][1]=0x40;
				}else if(6==i || 9==i){//	i in(6,9)
					ANDmaskCursor[i][0]=0x80;
					XORmaskCursor[i][0]=0x7E;
					ANDmaskCursor[i][1]=0x1;
					XORmaskCursor[i][1]=0x7E;
				}else if(i>=7 && i<=8){//	i in(7,8)
					ANDmaskCursor[i][0]=0x80;
					XORmaskCursor[i][0]=0x40;
					ANDmaskCursor[i][1]=0x1;
					XORmaskCursor[i][1]=0x2;
				}
			}
		}
		hCursor_ = CreateCursor( hinst,   // app. instance 
			7,//19,                // horizontal position of hot spot 
			7,//2,                 // vertical position of hot spot 
			32,                // cursor width 
			32,                // cursor height 
			ANDmaskCursor,     // AND mask 
			XORmaskCursor );   // XOR mask 

	}
}//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