實現背景漸變功能

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
    double y, Step = Height / 256.00;
    for(int i = 255; i > 0; i--){
        Form1->Canvas->Brush->Color = TColor(0x00000000+i*0x10000)  ;
        Form1->Canvas->FillRect(Rect(0, int(y), Width, int(y+Step)));
        y += Step;
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormResize(TObject *Sender)
{
    Form1->Refresh();
}
//--------------------------------------------------------------------------- 

發佈了21 篇原創文章 · 獲贊 0 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章