Hello every body..
I want to write a custom headerCell for a control inherited from dataGridView.
how it's possible to use a custom control(user control or a inherited control) into a DataGridViewColumnHeaderCell class? for a common control it's easy for example for check box by: CheckBoxRenderer.DrawCheckBox(...); . I just want to know how it's possible with user control or a inherited one????
Thanks ..
This is suppose to be my custom headerCell:
<pre lang="c#">
public class DataGridViewComboBoxHeaderCell:DataGridViewColumnHeaderCell
{
public DataGridViewComboBoxHeaderCell()
{
}
UnitConvertorComboBox.UnitConvertorComboBox Combo = new UnitConvertorComboBox.UnitConvertorComboBox();
protected override void Paint(System.Drawing.Graphics graphics,
System.Drawing.Rectangle clipBounds,
System.Drawing.Rectangle cellBounds,
int rowIndex,
DataGridViewElementStates dataGridViewElementState,
object value,
object formattedValue,
string errorText,
DataGridViewCellStyle cellStyle,
DataGridViewAdvancedBorderStyle advancedBorderStyle,
DataGridViewPaintParts paintParts)
{
base.Paint(graphics, clipBounds, cellBounds, rowIndex,
dataGridViewElementState, value,
formattedValue, errorText, cellStyle,
advancedBorderStyle, paintParts);
}
}
</pre>
And this is my custom control which inherited from combobox:
<pre lang="c#">
public partial class UnitConvertorComboBox : ComboBox
{
//Constructor
public UnitConvertorComboBox()
{
}
</pre>