Prev: How to install WCF templates?
Next: Same problem
From: Ralph on 15 Apr 2010 08:34 Instead of one of the existing column types I would like to have a user control appear in a cell in a gridview. What I have done is created a control CCTest : Control, IDataGridViewEditingControl inherits from Control, and implements IDataGridViewEditingControl I then create a cell class TestCell : DataGridViewCell in here I override public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) to set the editing control for the cell. these get used in a column I create and add to the datagridview. The problem I have is that I want the editing control to be the control that appears when the user first opens the form. In my test cell class I overrode Paint to do this. In here I create an instance of the custom control I want to appear. Then I use. tst.DrawToBitmap(bmp,new Rectangle(0,0,90,90)); graphics.DrawImage(bmp, cellBounds); where tst is the instance of the control I created. This works. However I was just curious as to if anyone has a better way to do this. I'm not really a fan of the solution I came up with. Thanks in advance Ralph
|
Pages: 1 Prev: How to install WCF templates? Next: Same problem |