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