Ahoj
mam Datagrid a do nej pridávam sloupce zdedene od typu DataGridViewButtonColumn
public partial class ColorPickerCell : DataGridViewButtonColumn
{
const float phi = 1.618f;
private Color colorValue;
public Color Color
{
get { return colorValue; }
set
{
colorValue = value;
}
}
public ColorPickerCell():base()
{
}
}
takto
dgvCinnosti.Columns.Add(new ColorPickerCell());
a jejich clikance chytam na handleru CellContentClick
private void dgvCinnosti_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
var senderGrid = (DataGridView)sender;
if (senderGrid.Columns[e.ColumnIndex] is ColorPickerCell && e.RowIndex >= 0)
{
//ColorPickerCell dgv = //((ColorPickerCell)senderGrid.Rows[e.RowIndex].Cells[e.ColumnIndex]).;
//DataGridViewButtonColumn b = senderGrid.CurrentCell as DataGridViewButtonColumn;
//senderGrid.
}
}
V tom IFu jsem na spravne tlacitku a ja bych potreboval ziskat instanci tho tlacitka abych mohl zmenit barvu tlacitka pripadne text - nikoli celeho CELLU jak na z9skam instanci toho tlacitka dik za kazdy namet