We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

control in a cell

Thread ID:





3417 Mar 17,2003 02:26 PM Mar 17,2003 04:08 PM Windows Forms 1
Tags: GridControl
Franklin Colbert
Asked On March 17, 2003 02:26 PM

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?

Administrator [Syncfusion]
Replied On March 17, 2003 04:08 PM

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....
		// 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).


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.