Panel-Schatten anders färben

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    // Panel1 ist das Panel was eingefärbt werden soll

    HDC hdc = GetDC(Panel1->Handle);
    TCanvas* canvas = new TCanvas;
    canvas->Handle = hdc;
    canvas->Pen->Color = clRed;
    canvas->PenPos = Point(0, Panel1->Height - 2);
    canvas->LineTo(Panel1->Width - 2, Panel1->Height - 2);
    canvas->LineTo(Panel1->Width - 2, 0);
    canvas->PenPos = Point(Panel1->Width - 1, 0);
    canvas->LineTo(Panel1->Width - 1, Panel1->Height - 1);
    canvas->LineTo(0, Panel1->Height - 1);
    delete canvas;
    ReleaseDC(Panel1->Handle, hdc);
}

Schreibe einen Kommentar