|
그림에서 보는 바와 같이 진행율에 따라 셀의 색상을 칠하고 싶습니다.
그런데, 색상을 칠하고, 진행율 글자( "34%")를 찍는 순간 배경색이 그냥
흰색으로 되어버립니다.
워떻게 해야 하는 지 ?
OnDrawCell 이벤트에 아래와 같이 적었습니다.
case 2: // Cell 2 => Progress Cell
{
int iPercent = StrToInt(sData.SubString(1, sData.Pos("%")-1));
TRect Rect2, Rect3;
Rect2.left = Rect.left; // 진행율색상을 칠할 영역 계산
Rect2.top = Rect.top;
Rect2.right = Rect.left + Rect.Width() * ( ((double)iPercent) * 0.01);
Rect2.bottom = Rect.bottom;
Rect3.left = Rect2.right+1; // 흰색으로 칠할 영역 계산
Rect3.top = Rect2.top;
Rect3.right = Rect.right;
Rect3.bottom = Rect.bottom;
pGrid->Canvas->Brush->Color = clLime; // 진행율 색상으로 칠한다
pGrid->Canvas->FillRect(Rect2);
pGrid->Canvas->Brush->Color = clWhite; // 흰색으로 칠한다.
pGrid->Canvas->FillRect(Rect3);
}
}
// "34%"를 표시하기 위한 코드 이 코드를 통과하면 셀의 전체 색상이 흰색으로 바뀌어 버림..
//unsigned oldalign = SetTextAlign(pGrid->Canvas->Handle, TA_CENTER);
//pGrid->Canvas->TextRect(Rect, (Rect.Right+Rect.Left)/2, Rect.Top+3, sData);
//SetTextAlign(pGrid->Canvas->Handle, oldalign);
도와 주세요..
|