Linq経由でデータソースにバインドされたXtraGridviewを持っています。チェックボックスをチェックすると、画像をセルに設定し、すでに値を設定する必要があります。 今チェックボックスをチェックすると、セル内の画像を正しく設定しても、セルの値(データ)は削除されます。 CustomDrawCellイベントで は、私はあなたががtrueにプロパティをe.Handled設定するため、このGridViewセルへの画像と値
private void gridView_GD_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
{
GridView view = sender as GridView;
string evento1 = Convert.ToString(view.GetRowCellValue(e.RowHandle, "Eve1"));
if (CVariables.Ficon_estado == 1)
{
if (evento1 == "06" || evento1 == "15")
{
if (e.Column.FieldName == "G1")
{
e.Handled = true;
Point pos = CalcPosition(e, imageCollection_16.Images[1]);
e.Graphics.DrawImage(imageCollection_16.Images[1], pos);
view.Columns["G1"].AppearanceCell.BackColor = Color.Transparent;
view.Columns["G1"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
}
}
}
else
{
view.Columns["G1"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
}
}
private Point CalcPosition(RowCellCustomDrawEventArgs e, Image img)
{
Point p = new Point();
p.X = e.Bounds.Location.X + (e.Bounds.Width - (img.Width * 3))/2;
p.Y = e.Bounds.Location.Y + (e.Bounds.Height - img.Height)/2;
return p;
}
I post an image to illustrate what i want
ありがとう、それは完璧に動作します。 – darielrp
私はe.Handle = trueとコメントします。ありがとう!!!!!! – darielrp