以前用过BCB6,现在新学开发工具C++ Bulder XE8,发现FireMonkey比较有特色,不过网上CB资料太少,找到几个不错的delphi写的FMX界面的Demo,学习改成了CB的,
语法有些不同,整理如下部分代码,以作对比参考:
Delphi | C++ Builder |
TButton(Sender).Enabled := false; SwitchTo3D; if Assigned(FContainer) then begin TAnimator.AnimateFloat(FContainer, ‘Position.Z‘, 300, 0.2); TAnimator.AnimateFloatDelay(FContainer, ‘Position.Z‘, 0, 0.2, 1); TAnimator.AnimateFloatWait(FContainer, ‘RotationAngle.Y‘, 360, 1.5, TAnimationType.&In, TInterpolationType.Linear); end; SwitchTo2D; TButton(Sender).Enabled := true; |
((TButton *)Sender)->Enabled = false; SwitchTo3D(); if(FContainer!=NULL) { TAnimator::AnimateFloat(FContainer, "Position.Z", 300, 0.2); TAnimator::AnimateFloatDelay(FContainer, "Position.Z", 0, 0.2, 1); TAnimator::AnimateFloatWait(FContainer, "RotationAngle.Y", 360, 1.5, TAnimationType::InOut , TInterpolationType::Linear); } SwitchTo2D(); ((TButton *)Sender)->Enabled = true; |
FViewport := TViewport3D.Create(Self); |
FViewport = new TViewport3D(this); FViewport->Align = TAlignLayout::Client; FViewport->Color = TAlphaColorRec::Null; FViewport->Parent = this; FContainer = new TLayer3D(this); FContainer->Parent = FViewport; FContainer->Projection = TProjection::Screen; FContainer->Transparency = true; FContainer->Align = TAlignLayout::Client; LImg = new TImage(this); // LImg->Align = TAlignLayout::Client; LImg->Position->X = rcmain->Position->X; LImg->Position->Y = rcmain->Position->Y; LImg->Width = rcmain->Width; LImg->Height = rcmain->Height; LImg->Bitmap->Assign(rcmain->MakeScreenshot()); LImg->Margins = rcmain->Margins; LImg->Parent = FContainer; rcmain->Visible = false; |
FreeAndNil(LImg); FreeAndNil(FContainer); FreeAndNil(FViewport); |
delete LImg; delete FContainer; delete FViewport; |