L
luckywangxw
Unregistered / Unconfirmed
GUEST, unregistred user!
我要做个歌词显示的东东,目前滚动时 仍有闪烁,设置窗体的 DoubleBuffered:=true 也没用,请教高手完善此程序,能够实现平滑滚动,我想到了aafont 目前正在研究,但我更想知道如果不用aafont 在此程序基础上如何改进,将改进代码发上来 或mail to me:luckywangxw%%%tom.com (%%%换成@),,例子主要代码如下(下载地址http://bbs.2ccc.com/attachments/2009/luckywangxw2_2009919174035.rar):procedure TForm1.aDrawText;var aRect:TRect; i:integer;begin tbmp.Canvas.Brush.Color :=clblack; tbmp.Canvas.Font.Color :=clwindow; tbmp.Canvas.FillRect(tbmp.Canvas.ClipRect ) ; for i:=0 to memo1.Lines.Count -1 do begin aRect.Left :=0; aRect.Top := lineheight*i + aPos; aRect.Right :=tbmp.Width ; aRect.Bottom :=aRect.Top+ lineheight; DrawText(tbmp.Canvas.Handle, PChar(memo1.Lines.Strings ), Length(memo1.Lines.Strings),arect , DT_CENTER or DT_SINGLELINE or DT_VCENTER) end; BitBlt(GetDc(Panel1.handle),0,0,Panel1.Width,Panel1.Height, tBmp.Canvas.Handle,0,0,srcCopy);end;procedure TForm1.FormCreate(Sender: TObject);begin tbmp:=TBitmap.create; tbmp.Width :=panel1.Width ; tbmp.Height :=panel1.Height ; aPos:=0; //滚动位置 scrolltimer.Enabled :=true; refreshtimer.Enabled :=true;end;procedure TForm1.ScrollTimerTimer(Sender: TObject);begin aPos:=aPos-1; if aPos<-memo1.Lines.Count*lineheight then aPos:= panel1.Height ; end;procedure TForm1.ScrollTimerTimer(Sender: TObject);begin aPos:=aPos-1; if aPos<-memo1.Lines.Count*lineheight then aPos:= panel1.Height ; end;