Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Звук, графика и видео > Движение Images к event Onmousemove


Автор: Deiv 27.1.2007, 15:38
Следующий код ниже, двигает изображение (Images) к event Onmousemove. 
Код

procedure TForm1.FormCreate(Sender: TObject);
begin
   G:= TBitMap.Create;
   G.LoadFromFile(getcurrentdir+'/molecule14.bmp');
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Canvas.Brush.Color := clBtnFace;
  Canvas.FillRect(Rect(10+i-2, 10, 10+I, 10+G.Height)); //clear old small rect
  Canvas.Draw(10+i,10,G); 
  //or:
  //Bitblt(Canvas.Handle, 10 + i, 10, G.Width, G.Height, G.Canvas.Handle, 0, 0, SRCCOPY);
  i:=i+2;
end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
   Timer1.Enabled:=false;
end;

procedure TForm1.BitBtn1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
    Timer1.Enabled:=true;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
   G.Free;
end;
end.

 
Как я могу сделать аналогичное тоже с Нескольким Образом (IMages)?  
У меня есть 9 изображение (Image) 100 x 150 pixels размера, мне нужно показать эти изображения c постоянным движением в Контейнерной Области (B TPanel'e или TPaintBox'e или TForm'e или и.т.д.) область=600 x 200 pixels, то есть= 4 изображения кажды 50 Pixels расстояния.  
Эти изображения (Images) к OnCreate event должны сначала показать мне 4 Образам, позже они должны пройти постоянно из левой к правую сторону, появляющийся на левой и исчезающийся на правой стороне, постепенно 9 Образы (Images).  
К eventy Onmousemove в Контейнерной Области (делился в двух частях: левая сторона= 300 pixels (ширина) и правая сторона= 300 pixels) к eventy Onmousemove, если указатель (mouse) находится в левой Области тогда Образы (Images) должны двинутся направо, и наоборот если указатель (mouse) находится в правой Области тогда образы должны двинутся налево, OnMouseMove. 
Вы можете помочь мне пожалуйста с некоторым кодом? 


Movement of Images to the event OnMouseMove  
The following code of UP, it moves an Image to the event OnMouseMove.   

How can I make something similar with Several Images?  
I have 9 size Images 100 x 150 pixels, I need to show these images in constant movement in a Container Area (TPanel or TPaintBox or TForm or etc.) of Area=600 x 200 pixels, that is to say = 4 Images with a space each 50 Pixels of distance.  
These Images to the event OnCreate should show me to the beginning 4 Images, later they should move constantly from left to right appearing and disappearing the 9 Images.  
To the Event OnMouseMove in the Container Area (divided in two parts: left-width= 300 pixels and right-width= 300pixels) to the event OnMouseMove, if the Mouse is in the Left Area then the Images should move to the Right, and contrary if the Mouse is in the Right Area then the images should move to the Left, OnMouseMove.  
Can you help me please with some code?
  

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)