Git   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何显示popup式窗口animation帧(从网格单元格开始)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在使用BDS 2007 …

用户在@R_239_9616@程序中双击网格单元格时,我们在网格上显示一个模态窗口。 我开发了下面的例程来在网格上绘制一个animation帧。 在窗口显示之前,通过逐步绘制和擦除框架来放大(非常类似于Windows UIanimation)。 窗口closures后,再次调用相同的例程(使用bExpand = false),以便将窗口的UI效果重新embedded到网格单元格中。

这个例程在Windows XP中工作正常,但启用Aero时会出现问题(在没有 Aero的Windows 7中工作正常)。 即使我注释掉DelaymSecs行(这只是一个重复调用Sleep(0)的循环,直到iDelay的毫秒数已经过去),animation帧也会重新绘制。

当程序再次被调用时(在窗口closures之后),它也同样缓慢,加上在屏幕上留下一个框架,再加上现在留下的(现在是closures的)窗口的幻影图像,基本上与正常显示网格的内容

例程的大部分代码都会计算不断变化的矩形大小。 animation矩形的实际绘制和删除只有三行:

ScreenCanvas.Rectangle( r ); //draw frame Sysstuff.DelaymSecs( iDelay ); // ScreenCanvas.Rectangle( r ); //pmXOR pen ...erase frame

任何想法,为什么这是在航空缓慢,或者我需要改变?

procedure T_fmExplore.AnimateRects(AsourceRect,ADestRect: TRect; bExpand: Boolean; bAdjustsourceForFrame: Boolean = TruE); { Draw animation frames in steps,for transition from AsourceRect to ADestRect. bExpand: determines whether the animation rect is expanding or contracTing. bAdjustsourceForFrame: resize the animation rect smaller for the window frame. } const MINSTEPS = 10; //Min redraws of the animation rect (framE) MAXSTEPS = 20; //30 was too many,too slow MAXDELAY = 100; //Delay between drawing each rect frame MINDELAY = 1; var iSteps: Integer; DeltaHt: Integer; //Rect size chg for each redraw of animation window DeltaWidth: Integer; DeltaTop : Integer; //Origin change for each redraw DeltaLeft : Integer; TgtWidth,TgtHt: Integer; iTemp: Integer; iDelay: Integer; r : TRect; //Animation frame's rect ScreenCanvas: TCanvas; begin r := AsourceRect; TgtWidth := ADestRect.Right - ADestRect.Left; //Target rect's Width TgtHt := ADestRect.bottom - ADestRect.Top; //Target rect's Height //Initially Deltas hold @R_389_10586@l chg in Width & Height DeltaWidth := TgtWidth - (r.Right - r.Left); //TgtWidth - old width DeltaHt := TgtHt - (r.bottom - r.Top); //For smooth animation we adjust number of iSteps & Delay relative to the window area. //Larger window = more iSteps and shorter Delay between drawing each step. iSteps := Max( DeltaWidth * DeltaHt div 6500,MINSTEPS ); iSteps := Min( iSteps,MAXSTEPS ); //Now convert Deltas to the delta in window rect size DeltaWidth := DeltaWidth div iSteps; DeltaHt := DeltaHt div iSteps; DeltaTop := (ADestRect.Top - AsourceRect.Top) div iSteps; DeltaLeft := (ADestRect.Left - AsourceRect.Left) div iSteps; iDelay := Max( MAXDELAY div iSteps,MINDELAY ); ScreenCanvas := TCanvas.Create; try ScreenCanvas.Handle := GetDC( 0 ); //Desktop try with ScreenCanvas do begin Pen.Color := clWhite; //Do NOT use clBlack with pmXOR mode: with (r=0,g=0,b=0) there are no bytes to XOR. Pen.Mode := pmXOR; //MUST use pmXOR pen,so 2nd Rectangle call (see below) erases what we drew. Pen.Style := psSolid; Pen.Width := 3; //Thin line. Was: Pen.Width := GetSy@L_570_19@metrics(SM_CXFRAME); Brush.Style := bsClear; if bAdjustsourceForFrame then InflateRect(AsourceRect,-Pen.Width,-Pen.Width); repeat iTemp := (r.bottom - r.Top) + DeltaHt; //Height if (bExpand and (iTemp > TgtHt)) or (not bExpand and (iTemp < TgtHt)) then begin r.Top := ADestRect.Top; r.bottom := Top + TgtHt; end else begin r.Top := r.Top + DeltaTop; //Assign Top first...bottom is calc'd from it r.bottom := r.Top + iTemp; end; iTemp := (r.Right - r.Left) + DeltaWidth; //Width if (bExpand and (iTemp > TgtWidth)) or (not bExpand and (iTemp < TgtWidth)) then begin r.Left := r.Left + DeltaLeft; r.Right := r.Left + TgtWidth; end else begin r.Left := r.Left + DeltaLeft; //Assign Left first...Right is calc'd from it r.Right := r.Left + iTemp; end; ScreenCanvas.Rectangle( r ); //draw frame Sysstuff.DelaymSecs( iDelay ); // ScreenCanvas.Rectangle( r ); //pmXOR pen ...erase frame until (r.Right - r.Left = TgtWidth) and (r.bottom - r.Top = TgtHt); end; finally ReleaseDC( 0,ScreenCanvas.Handle ); ScreenCanvas.Handle := 0; end; finally ScreenCanvas.Free; end; end;

大佬总结

以上是大佬教程为你收集整理的如何显示popup式窗口animation帧(从网格单元格开始)全部内容,希望文章能够帮你解决如何显示popup式窗口animation帧(从网格单元格开始)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: