2
我有一個資源在我的編(* .bmp圖像)。當我啓動一個計時器時,我的圖像應該旋轉,直到我點擊「暫停」。我需要一個解釋我如何做到這一點的樣本。如何動態旋轉圖片?
目前我使用此代碼:
void rotatewaiticon()
{
Graphics::TBitmap *bmpOriginal = new Graphics::TBitmap();
//bmpOriginal->LoadFromResourceName(0,"bmpcrug");
bmpOriginal->LoadFromFile("degrees.bmp");
FormMain->Image65->Picture->Assign(bmpOriginal);
Graphics::TBitmap *bmpCopy = new Graphics::TBitmap();
bmpCopy->Width = bmpOriginal->Height;
bmpCopy->Height = bmpOriginal->Width;
int wOr = bmpOriginal->Width, hOr = bmpOriginal->Height;
for(int x = 0; x < wOr; x++)
{
for(int y = 0; y < hOr; y++)
{
bmpCopy->Canvas->Pixels[hOr - y][x] = bmpOriginal->Canvas->Pixels[x][y];
}
}
/**/FormMain->Image65->Picture->Assign(bmpCopy);
bmpCopy->SaveToFile("degrees.bmp");
delete bmpOriginal, bmpCopy;
}
但我不明白的方式與此文件的工作,但不保存在磁盤上。