control in a cell

I have a situation where I wish to display a control over the active cell for a particular column. This control is not a .NET control, but rather a Win32 HWND for which I have the handle. I am creating this HWND hidden and will position it appropriately and unhide it as the user moves to the row and column. I am taking the route of Creating my own CellModel and CellRenderer. However I am stuck a bit in how to proceed from here. Any good samples? Should I create a generic .NET control and parent my HWND to it?

1 Reply

AD Administrator Syncfusion Team March 17, 2003 09:08 PM UTC

If you only want to draw your special window when a cell is the active cell, then the simplest thing to try is to override the renderer's OnDraw method, and if the cell is a current cell and is active, then display your window. Otherwise, call the baseclass.
protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style) 
{
	if (Grid.CurrentCell.HasCurrentCellAt(rowIndex, colIndex) && CurrentCell.IsEditing && !Grid.IsPrinting())
	{
		//show you window....
	}
	else
	{
		// static cell
		base.OnDraw(g, clientRectangle, rowIndex, colIndex, style);
	}
}
As far as samples, here are some: 1) the CustomCellTutoral that displays a LinkLable cell 2) button cells in the Button cells sample 3) bitmap cells in the Exel-like selection sample. If you submit a Direct Trac incident, you can request some new samples that will be part of the upcoming 1.6 release (MaskeEdit, Currency and WinForm in a cell).

Loader.
Up arrow icon