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
   | void __fastcall JHint::Paint()
{
int w, h;
int maxwidth=0;
int maxheight=0;
if(Bitmap != NULL)
    {
    for(int j = 0; j < List->Count; j++)
        {
        w = Canvas->TextWidth(List->Strings[j]);
        if(w > maxwidth) maxwidth = w;
        h = Canvas->TextHeight(List->Strings[j]);
        if(h > maxheight) maxheight = h;
        }
    SetBounds(Left, Top, maxwidth + 8, (h * List->Count) + 8 );
    if((Bitmap->Width != Width) || (Bitmap->Height != Height))
        {
        Bitmap->Width = Width; Bitmap->Height = Height;
        }
    TCanvas *C = Bitmap->Canvas; //pour mon BCB3
    C->Pen->Color = clBlack;
    C->Pen->Mode =pmCopy;
    C->Pen->Style = psSolid;
    C->Brush->Color = Color; //pour éviter un scintillement
    C->Brush->Style = bsSolid;
    C->Rectangle(0,0, Width, Height);
    C->Brush->Style = bsClear; //on ne dessine que le texte
    int y = 4;
    for(int j = 0; j < List->Count; j++)
        {
        C->TextOut(4, y, List->Strings[j]);
        y+=h;
        }
    Canvas->Draw(0,0,Bitmap);
    }
} | 
Partager