0
當您拖動列標題以在Windows資源管理器中對其進行重新排序(或在Chrome中拖動標籤頁)時,您將獲得一個很好的動畫,其中的其他標題按鈕會輪換以騰出空間。動態拖放自定義Delphi組件
我試圖在我正在寫的標題控件中複製它。標題按鈕不是單獨的控件,所以我有一個控件,我在其中進行測試以確定哪個按鈕被點擊。除了一些會引入大量閃爍的策略之外,我並不確定如何去做這些動畫。
當您拖動列標題以在Windows資源管理器中對其進行重新排序(或在Chrome中拖動標籤頁)時,您將獲得一個很好的動畫,其中的其他標題按鈕會輪換以騰出空間。動態拖放自定義Delphi組件
我試圖在我正在寫的標題控件中複製它。標題按鈕不是單獨的控件,所以我有一個控件,我在其中進行測試以確定哪個按鈕被點擊。除了一些會引入大量閃爍的策略之外,我並不確定如何去做這些動畫。
嘗試使用自己的油漆緩衝區(如果DoubleBuffered不夠好):
TMyControl.Paint
:複製緩衝區目標帆布是這樣的:
type
TMyControl = class(TWinControl)
private
FAnimationBuffer: TBitmap;
FTimer: Cardinal;
procedure OnTimer(var Message: TMessage); message WM_TIMER;
protected
procedure Paint; override;
procedure Animate(columnA, columnB: Integer; frames: Byte);
end;
procedure TMyControl.OnTimer(var Message: TMessage);
begin
//todo : paint control state to FAnimationBuffer
if Visible then
Invalidate;
end;
procedure TMyControl.Paint;
begin
Canvas.Draw(0,0,FAnimationBuffer);
end;
procedure TMyControl.Animate;
begin
FTimer := SetTimer(Handle, 1, 100, nil);
end;
['TChromeTabs'(https://github.com/norgepaul/TChromeTabs)做這種動畫。 – TLama