Цитата(Anikmar @ 16.2.2007, 19:47) | Можно код посмотреть, где двигается текст? |
Код | // TAnimatedBS - класс вывода строки на экран //--------------------------------------------------------------------------- __fastcall TAnimatedBS::TAnimatedBS(TComponent* Owner) : TControl(Owner) { } //--------------------------------------------------------------------------- __fastcall TAnimatedBS::~TAnimatedBS() { } //--------------------------------------------------------------------------- // функция 1 шага отрисовки long TAnimatedBS::Ticket() { c->Brush->Color = Color; c->Pen->Color = Color; c->Rectangle( rTemp);
rTemp.left -= StepUp; rTemp.right -= StepUp;
c->TextOut( rTemp.left, mh, msgStr );
BitBlt TGraphics
if ( rTemp.right != 0 && rTemp.right == mw2 ) return 2; if ( rTemp.right < 0 ) return 0; return 1; } //--------------------------------------------------------------------------- // запоминаем что надо рисовать и вычисляем размеры void TAnimatedBS::SetText( AnsiString text, AnsiString phone, int w, int h ) { int l; width = w; height = h;
msgStr = text + " " + phone; mh = c->TextHeight(text); mw1 = c->TextWidth(text + " " ); mw2 = c->TextWidth(phone); mw = mw1 + mw2; // запомнить место рисования rTemp = Rect( width, height - mh , width+mw , height ); len = tmpStr.Length(); tmp = 1; } //--------------------------------------------------------------------------- // узнаем место рисования, шаг смещения и цвет void TAnimatedBS::SetCanv( TCanvas *canv, int PixelLeft, TColor color) { StepUp = PixelLeft; Color = color; c = canv; } //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- __fastcall TPanelBS::TPanelBS(TComponent* Owner) : TWinControl(Owner) { NeedUpdate = 0; Width = 150; Height = 50; ParentFont = false; Color = clWhite; p = new TStringList;
Tr = new TpFIBTransaction(this); qData = new TpFIBDataSet((TComponent*)this);
Timer = new TTimer(this); Timer->Enabled = false;
lMsg = new TLabel(this); lMsg->AutoSize = false; lMsg->Parent = this; lMsg->WordWrap = false; // lMsg->Alignment = taCenter; lMsg->Transparent = true; lMsg->ParentColor = false; lMsg->Color = clGreen;
OnResize = SetSize; at = new TAnimatedBS(lMsg); } //--------------------------------------------------------------------------- __fastcall TPanelBS::~TPanelBS(void) { delete p; } //---------------------------------------------------------------------------
|
|