inno setup 图片滚动 yang


//
//
//
//
//
//  有朋友反映webctrl 和 isshowside 不支持窗口拖拽,这里通过botva2衍生制作一个渐显的图片轮播,代码还能完善一下 这里做一个参考给大家。
//
//  通过botv2 衍生 ImgSetVisibilityEX(控制四图) ImgSetTransparentEx(控制四图) 这个两个衍生的procedure 大家可以自己修改成更多图的,
//
//
//
//  代码.mad8834671
[setup]
AppName=图片轮播
AppVerName=图片轮播
DefaultDirName=.\TEST
AppVersion=1.0
VersionInfoCompany=图片轮播
VersionInfoCopyright=mad8834671
VersionInfoDescription=图片轮播
VersionInfoProductName=mad8834671
VersionInfoProductTextVersion=mad8834671
VersionInfoProductVersion=1.0
VersionInfoTextVersion=1.0
VersionInfoVersion=1.0
Uninstallable=no
OutputBaseFilename=图片轮播
OutputDir=.

[Messages]
SetupAppTitle=
SetupWindowTitle=%1
[Files]
Source:Files\* ; DestDir: {tmp}; Flags: dontcopy solidbreak; Attribs: hidden system



#include 'botva2.iss'
function  ReleaseCapture(): Longint; external 'ReleaseCapture@user32.dll stdcall';
{ RedesignWizardFormBegin } // 不要删除这一行代码。
// 不要修改这一段代码,它是自动生成的。
var
  NewButton1: TNewButton;
  Timer1: TTimer;

procedure NewButton1Click(Sender: TObject); forward;
procedure Timer1Timer(Sender: TObject); forward;

procedure RedesignWizardForm;
begin
  with WizardForm.WizardBitmapImage do
  begin
    Left := ScaleX(-159);
    Top := ScaleY(-76);
  end;

  with WizardForm.WelcomeLabel2 do
  begin
    Left := ScaleX(-296);
    Top := ScaleY(-20);
  end;

  with WizardForm.WelcomeLabel1 do
  begin
    Left := ScaleX(-280);
    Top := ScaleY(-9);
  end;

  { NewButton1 }
  NewButton1 := TNewButton.Create(WizardForm);
  with NewButton1 do
  begin
    Parent := WizardForm;
    Left := ScaleX(50);
    Top := ScaleY(125);
    Width := ScaleX(50);
    Height := ScaleY(25);
    Caption := '测试';
    OnClick := @NewButton1Click;
  end;

  { Timer1 }
  Timer1 := TTimer.Create(WizardForm);
  with Timer1 do
  begin
    OnTimer := @Timer1Timer;
  end;

  NewButton1.TabOrder := 5;

{ ReservationBegin }
  // 这一部分是提供给你的,你可以在这里输入一些补充代码。

{ ReservationEnd }
end;
// 不要修改这一段代码,它是自动生成的。
{ RedesignWizardFormEnd } // 不要删除这一行代码。



var
t1,t2,t3,t4,DHIMG1:Longint;
js1,js2:integer;

procedure ImgSetVisibilityEx(IMGl1,IMGl2,IMGl3,IMGl4: Longint;I1,I2,I3,I4:integer);     //ImgSetVisibility   衍生的   ImgSetVisibilityEX 可以参考以下增加或减少  代码.mad8834671
begin
  if I1=0 then                   // I1=0 表示false  大于0 都表示true 下同
  begin
  ImgSetVisibility(IMGl1,false)
  end else
  begin
  ImgSetVisibility(IMGl1,true)
  end;
  if I2=0 then
  begin
  ImgSetVisibility(IMGl2,false)
  end else
  begin
  ImgSetVisibility(IMGl2,true)
  end;
  if I3=0 then
  begin
  ImgSetVisibility(IMGl3,false)
  end else
  begin
  ImgSetVisibility(IMGl3,true)
  end;
  if I4=0 then
  begin
  ImgSetVisibility(IMGl4,false)
  end else
  begin
  ImgSetVisibility(IMGl4,true)
  end;
end;
procedure ImgSetTransparentEx(IMGl1,IMGl2,IMGl3,IMGl4: Longint;Transparent:integer);   //ImgSetTransparent   衍生的   ImgSetTransparentEx 可以参考以下增加或减少   代码.mad8834671
begin
  ImgSetTransparent(IMGl1,Transparent)     //Transparent 为了方便控制透明值
  ImgSetTransparent(IMGl2,Transparent)
  ImgSetTransparent(IMGl3,Transparent)
  ImgSetTransparent(IMGl4,Transparent)
end;


procedure Timer1Timer(Sender: TObject);   //核心代码 时钟控制动画 需要inno5 增强版      代码.mad8834671
begin

  js2:=js2+10; //控制图片透明度
if js2<255 then
  begin
  ImgSetTransparentEx(t1,t2,t3,t4,255-js2-5)
  end;
if js2=260 then
  begin
  js1:=js1+1;  //控制显示图片
if js1=1 then
  begin
  ImgSetVisibilityEx(t1,t2,t3,t4,1,0,0,0)
  end;
if js1=2 then
  begin
  ImgSetVisibilityEx(t1,t2,t3,t4,0,1,0,0)
  end;
if js1=3 then
  begin
  ImgSetVisibilityEx(t1,t2,t3,t4,0,0,1,0)
  end;
if js1=4 then
  begin
  ImgSetVisibilityEx(t1,t2,t3,t4,0,0,0,1)
  end;
if js1>4 then
  begin
  ImgSetVisibilityEx(t1,t2,t3,t4,1,0,0,0)
  js1:=1
  end;
  end;
if (js2>260) and (js2<520) then  //控制图片透明度
  begin
  ImgSetTransparentEx(t1,t2,t3,t4,js2-255)
  end;
if  (js2>510) then      //控制图片透明度 计数归零
  begin
  js2:=0
  end;
  ImgApplyChanges(WizardForm.Handle)
end;    //核心代码

procedure NewButton1Click(Sender: TObject);   //控制速度  Timer1.Interval:=20
begin
  if  Timer1.Interval=0 then
  begin
  Timer1.Interval:=50
  end else
  begin
  Timer1.Interval:=0
  end;
end;


procedure WizardMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture
  SendMessage(WizardForm.Handle, $0112, $F012, 0)
end;
procedure InitializeWizard();
begin
  RedesignWizardForm;
  Timer1.Interval:=0
  js1:=1
  ExtractTemporaryFile('01.jpg')    //提取图片
  ExtractTemporaryFile('02.jpg')
  ExtractTemporaryFile('03.jpg')
  ExtractTemporaryFile('04.jpg')
  WizardForm.OuterNotebook.Hide;
  WizardForm.BorderStyle :=bsnone
  WizardForm.OnMouseDown:=@WizardMouseDown
end;


procedure DHcore();
begin
  RedesignWizardForm;
end;



procedure CurPageChanged(CurPageID: Integer);
begin

  WizardForm.Height:=150
  WizardForm.Width:=150
  t1:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\01.jpg'),0,0,150,150,true,true);    //加载图片必备的
  t2:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\02.jpg'),0,0,150,150,true,true);
  t3:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\03.jpg'),0,0,150,150,true,true);
  t4:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\04.jpg'),0,0,150,150,true,true);
  ImgSetVisibility(t1,true)     //出现动画时 第一张显示的图片   下面几张禁用的
  ImgSetVisibility(t2,false)
  ImgSetVisibility(t3,false)
  ImgSetVisibility(t4,false)
  ImgApplyChanges(WizardForm.Handle)
end;

procedure DeinitializeSetup();
begin
gdipShutdown;
end;

[ISFormDesigner]
WizardForm=FF0A005457495A415244464F524D0030103E02000054504630F10B5457697A617264466F726D0A57697A617264466F726D0C436C69656E74486569676874034C010B436C69656E74576964746803F1010D4578706C6963697457696474680301020E4578706C696369744865696768740373010D506978656C73506572496E636802600A54657874486569676874020C00F10C544E65774E6F7465626F6F6B0D4F757465724E6F7465626F6F6B00F110544E65774E6F7465626F6F6B506167650B57656C636F6D655061676500F10C544269746D6170496D6167651157697A6172644269746D6170496D616765044C6566740361FF03546F7002B40C4578706C696369744C6566740361FF0B4578706C69636974546F7002B40000F10E544E6577537461746963546578740D57656C636F6D654C6162656C32044C65667403D8FE03546F7002EC0C4578706C696369744C65667403D8FE0B4578706C69636974546F7002EC0000F10E544E6577537461746963546578740D57656C636F6D654C6162656C31044C65667403E8FE03546F7002F70C4578706C696369744C65667403E8FE0B4578706C69636974546F7002F7000000000A544E6577427574746F6E0A4E6577427574746F6E31044C656674023203546F70027D05576964746802320648656967687402190743617074696F6E12020000004B6DD58B085461624F726465720205074F6E436C69636B070F4E6577427574746F6E31436C69636B0000065454696D65720654696D657231074F6E54696D6572070B54696D65723154696D6572044C656674021003546F700208000000



本站评论列表

评论内容请遵守相关法律法规,所有评论内容人工审核,一旦确定为垃圾评论,永久禁止用户发言。
使用qq免注册登陆:使用qq登陆
      
本站声明
本文转载自:ITEYE博客频道     作者:ydw5271084    发布日期:2015-08-30
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。


 
© 2014-2016 ITdaan.com 粤ICP备14056181号