Тема: фотки
Показать сообщение отдельно
Старый 01.05.2010, 17:35   #63
im_zorg
Знающий
 
Регистрация: 25.10.2009
Сообщений: 338
Написано 53 полезных сообщений
(для 61 пользователей)
Ответ: фотки

uses canvas;
Var     
x,yxiyi,xsysxs1ys1statei,w,hinteger;
ris,newimgimage;
Begin
                ris
:=LoadImage('/icon.png');
                
w:=getwidth;h:=getheight;
                
xi:=GetImageWidth(ris);
                
yi:=GetImageHeight(ris);
                
xs:=GetWidth;
                
ys:=GetHeight;
                
xs1:=GetStringWidth('вверх');
                
ys1:=GetStringHeight('вверх');
                
DrawImage(ris,x,y);Repaint;
repeat
                state
:=GetKeyClicked;
                if 
state=KE_KEY4  then begin x:=x-20; if (x<xs-xithen x:=xs-xiend;
                if 
state=KE_KEY6  then begin x:=x+20; if (x>0then x:=0end;
                if (
state=KE_KEY2)  or (state=-6then begin y:=y-20; if (y<ys-yithen y:=ys-yii:=i+1end
                
if (state=KE_KEY8)  or (state=-7then begin y:=y+20; if (y>0then y:=0end;
                if 
w<h then
                newimg
:=canvas.resize_image(ris,w,trunc((getimageHeight(ris)*w)/getimagewidth(ris)));
                if 
w>h then
                newimg
:=canvas.resize_image(ris,trunc((getimageWidth(ris)*h)/getimageheight(ris)),h);
                if 
w=h then ris:=newimg;
                
DrawImage(newimg,0,0);
                
//DrawImage(ris,x,y); зачем ты рисуешь эту картинку???
                
SetColor(00255); 
                
FillRect(xs-xs1,ys-ys1,xs1,ys1); FillRect(0,ys-ys1,xs1,ys1); 
                
SetColor(02550); 
                
DrawText('вверх',xs-xs1+5,ys-ys1);
                
DrawText('вниз',0,ys-ys1);
         
Repaint;
         
Delay(20);
    
until false;
End
(Offline)
 
Ответить с цитированием