From ae7032967e4fd73fb153e2b95df8257f3291c241 Mon Sep 17 00:00:00 2001 From: jiro Date: Wed, 11 Mar 2015 18:54:59 +0900 Subject: [PATCH] =?utf8?q?=E5=A4=96=E8=A6=B3=E3=82=92=E8=AA=BF=E6=95=B4?= =?utf8?q?=E3=80=80Image2=E3=82=92=E5=BB=83=E6=AD=A2=E3=80=80OpenDialog1?= =?utf8?q?=E3=82=92=E3=83=80=E3=83=9F=E3=83=BC=E3=82=AA=E3=83=96=E3=82=B8?= =?utf8?q?=E3=82=A7=E3=82=AF=E3=83=88=E3=81=AB=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Unit1.fmx | 37 +++++++++++++++++++------------------ Unit1.pas | 48 +++++++++++++++++++++++++++++++++--------------- vobslideshow.dpr | 4 +++- vobslideshow.dproj | 6 +++++- 4 files changed, 60 insertions(+), 35 deletions(-) diff --git a/Unit1.fmx b/Unit1.fmx index 01850c5..fa04665 100644 --- a/Unit1.fmx +++ b/Unit1.fmx @@ -18,10 +18,11 @@ object Form1: TForm1 Size.Width = 481.000000000000000000 Size.Height = 345.000000000000000000 Size.PlatformDefault = False + WrapMode = Stretch end object ListView1: TListView - ItemAppearanceClassName = 'TListItemAppearance' - ItemEditAppearanceClassName = 'TListItemShowCheckAppearance' + ItemAppearanceClassName = 'TImageListItemRightButtonAppearance' + ItemEditAppearanceClassName = 'TImageListItemRightButtonDeleteAppearance' HeaderAppearanceClassName = 'TListHeaderObjects' FooterAppearanceClassName = 'TListHeaderObjects' Position.X = 24.000000000000000000 @@ -78,19 +79,20 @@ object Form1: TForm1 OnClick = Button2Click end end + object MenuItem7: TMenuItem + Text = 'Setting' + object MenuItem8: TMenuItem + Locked = True + Text = 'Effects' + OnClick = MenuItem8Click + end + end end object OpenDialog1: TOpenDialog Filter = #30011#20687#12501#12449#12452#12523'(*.jpg;*.jpeg;*.bmp;*png)|*.jpg;*.jpeg;*.bmp;*.png' Options = [ofHideReadOnly, ofAllowMultiSelect, ofEnableSizing] Left = 176 Top = 264 - end - object Image2: TImage - MultiResBitmap = < - item - end> - Position.X = 208.000000000000000000 - Position.Y = 80.000000000000000000 object BandedSwirlTransitionEffect1: TBandedSwirlTransitionEffect Progress = 0.000000000000000000 Strength = 1.000000000000000000 @@ -169,15 +171,6 @@ object Form1: TForm1 RandomSeed = 0.300000011920929000 end end - object ListBox1: TListBox - Position.X = 200.000000000000000000 - Position.Y = 376.000000000000000000 - TabOrder = 16 - DisableFocusEffect = True - DefaultItemStyles.ItemStyle = '' - DefaultItemStyles.GroupHeaderStyle = '' - DefaultItemStyles.GroupFooterStyle = '' - end object FloatAnimation1: TFloatAnimation Duration = 5.000000000000000000 Interpolation = Exponential @@ -186,4 +179,12 @@ object Form1: TForm1 StartValue = 0.000000000000000000 StopValue = 100.000000000000000000 end + object ComboBox1: TComboBox + Position.X = 464.000000000000000000 + Position.Y = 480.000000000000000000 + Size.Width = 148.000000000000000000 + Size.Height = 22.000000000000000000 + Size.PlatformDefault = False + TabOrder = 22 + end end diff --git a/Unit1.pas b/Unit1.pas index e69055f..ba1158e 100644 --- a/Unit1.pas +++ b/Unit1.pas @@ -42,20 +42,22 @@ type Button1: TButton; OpenDialog1: TOpenDialog; Button2: TButton; - Image2: TImage; - ListBox1: TListBox; MenuItem1: TMenuItem; MenuItem2: TMenuItem; MenuItem3: TMenuItem; MenuItem4: TMenuItem; MenuItem5: TMenuItem; MenuItem6: TMenuItem; + ComboBox1: TComboBox; + MenuItem7: TMenuItem; + MenuItem8: TMenuItem; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure ListView1Change(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FloatAnimation1Finish(Sender: TObject); procedure MenuItem5Click(Sender: TObject); + procedure MenuItem8Click(Sender: TObject); private { private éŒ¾ } public @@ -69,15 +71,25 @@ implementation {$R *.fmx} +uses Unit2; + procedure TForm1.Button1Click(Sender: TObject); var i: Integer; + s: TListViewItem; begin if OpenDialog1.Execute = true then begin ListView1.Items.Clear; for i := 0 to OpenDialog1.Files.Count - 1 do - ListView1.Items.Add.Text := OpenDialog1.Files[i]; + begin + s:=ListView1.Items.Add; + s.Text:=ExtractFileName(OpenDialog1.Files[i]); + s.Detail := OpenDialog1.Files[i]; + s.Bitmap.LoadFromFile(OpenDialog1.Files[i]); + end; + if ListView1.ItemCount > 0 then + ListView1.ItemIndex:=0; end; end; @@ -86,39 +98,39 @@ var s: TFmxObject; i: Integer; begin - if Image1.Bitmap.IsEmpty = false then + if (ListView1.ItemIndex > -1)and(ListView1.ItemIndex < ListView1.ItemCount-1) then begin FloatAnimation1.Stop; - for i := 0 to Image2.ChildrenCount - 1 do - if Image2.Children[i].ClassName = ListBox1.Items[ListBox1.ItemIndex] then - s := Image2.Children[i]; + for i := 0 to OpenDialog1.ChildrenCount - 1 do + if OpenDialog1.Children[i].ClassName = ComboBox1.Items[ComboBox1.ItemIndex] then + s := OpenDialog1.Children[i]; s.Parent := Image1; FloatAnimation1.Parent := s; - SetObjectProp(s, 'target', Image2.Bitmap); + SetObjectProp(s, 'target', ListView1.Items[ListView1.ItemIndex+1].Bitmap); FloatAnimation1.Start; end; end; procedure TForm1.FloatAnimation1Finish(Sender: TObject); begin - FloatAnimation1.Parent.Parent := Image2; + FloatAnimation1.Parent.Parent := OpenDialog1; + ListView1.ItemIndex:=ListView1.ItemIndex+1; + Image1.Bitmap.Assign(ListView1.Items[ListView1.ItemIndex].Bitmap); end; procedure TForm1.FormCreate(Sender: TObject); var i: Integer; begin - for i := 0 to Image2.ChildrenCount - 1 do - ListBox1.Items.Add(Image2.Children[i].ClassName); - ListBox1.ItemIndex := 0; + for i := 0 to OpenDialog1.ChildrenCount - 1 do + ComboBox1.Items.Add(OpenDialog1.Children[i].ClassName); + ComboBox1.ItemIndex := 0; end; procedure TForm1.ListView1Change(Sender: TObject); begin FloatAnimation1.Stop; - Image1.Bitmap.LoadFromFile(ListView1.Items[ListView1.ItemIndex].Text); - if ListView1.ItemIndex < ListView1.ItemCount - 1 then - Image2.Bitmap.LoadFromFile(ListView1.Items[ListView1.ItemIndex + 1].Text); + Image1.Bitmap.Assign(ListView1.Items[ListView1.ItemIndex].Bitmap); end; procedure TForm1.MenuItem5Click(Sender: TObject); @@ -126,4 +138,10 @@ begin Close; end; +procedure TForm1.MenuItem8Click(Sender: TObject); +begin + if Form2.ShowModal = mrOK then + ComboBox1.Items.Assign(Form2.ListBox2.Items); +end; + end. diff --git a/vobslideshow.dpr b/vobslideshow.dpr index 6167206..9c3a8f0 100644 --- a/vobslideshow.dpr +++ b/vobslideshow.dpr @@ -3,12 +3,14 @@ program vobslideshow; uses System.StartUpCopy, FMX.Forms, - Unit1 in 'Unit1.pas' {Form1}; + Unit1 in 'Unit1.pas' {Form1}, + Unit2 in 'Unit2.pas' {Form2}; {$R *.res} begin Application.Initialize; Application.CreateForm(TForm1, Form1); + Application.CreateForm(TForm2, Form2); Application.Run; end. diff --git a/vobslideshow.dproj b/vobslideshow.dproj index 903528d..7ca4bde 100644 --- a/vobslideshow.dproj +++ b/vobslideshow.dproj @@ -5,7 +5,7 @@ FMX vobslideshow.dpr True - Debug + Release Win32 95 Application @@ -215,6 +215,10 @@
Form1
fmx + +
Form2
+ fmx +
Cfg_2 Base -- 2.11.0