1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
TCanvas *C = Matrice1->Canvas;
Graphics::TBitmap *Bitmap = Image1->Picture->Bitmap;
jRgb *L;
AnsiString N;
int we, he;
int cx = (Rect.Left + Rect.Right) / 2;
int cy = (Rect.Top + Rect.Bottom) / 2;
if((Row == 0) && (Col != 0))
{
C->Brush->Style = bsSolid;
C->Brush->Color = clSilver;
C->FillRect(Rect);
N = IntToStr(Col-1);
we = C->TextWidth(N) / 2;
he = C->TextHeight(N) / 2;
C->TextOut(cx - we, cy - he, N);
}
else
{
if((Col == 0) && (Row != 0))
{
C->Brush->Style = bsSolid;
C->Brush->Color = clSilver;
C->FillRect(Rect);
N = IntToStr(Row-1);
we = C->TextWidth(N) / 2;
he = C->TextHeight(N) / 2;
C->TextOut(cx - we, cy - he, N);
}
else
{
if((Row != 0) && (Col != 0))
{
C->Brush->Style = bsSolid;
C->Brush->Color = clWhite;
C->FillRect(Rect);
L = (jRgb*)Bitmap->ScanLine[Row-1];
N = IntToStr( L[Col-1].R ) + "," +
IntToStr( L[Col-1].G ) + "," +
IntToStr( L[Col-1].B );
we = C->TextWidth(N) / 2;
he = C->TextHeight(N) / 2;
C->TextOut(cx-we, cy - he, N);
}
else
{
C->Brush->Style = bsSolid;
C->Brush->Color = clSilver;
C->FillRect(Rect);
N = "R,G,B";
we = C->TextWidth(N) / 2;
he = C->TextHeight(N) / 2;
C->TextOut(cx-we, cy - he, N);
}
}
} |
Partager