|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
OnDrawCell problem
I am using the below code to write two small rectangles in two colors in column 1 of row 1.It writes them properly,but once the cell is clicked or form is moved, the rectangles disappear as I don't know how to store this value in StringGrid1->Cells[1][1].
What code should be added? void __fastcall Form1::OnStringGrid1DrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect1, TGridDrawState State) { if(ACol == 1 && ARow == 1) { int i = 2; int j = 4; StringGrid1->Canvas->Brush->Color= clYellow; StringGrid1->Canvas->FillRect(Rect(Rect1.Left+i, Rect1.Top + 3, Rect1.Left+j, Rect1.Top + 11)); i=i+3; j=j+3; StringGrid1->Canvas->Brush->Color= clRed; StringGrid1->Canvas->FillRect(Rect(Rect1.Left+i, Rect1.Top + 3, Rect1.Left+j, Rect1.Top + 11)); } } |
|
#2
|
|||
|
|||
|
Realised the problem was due to something else outside this piece of code :-)
problem solved ! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > OnDrawCell problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|