如何实现图片缩略显示
?牐犠吕醋邢赶胂耄伤趼酝贾饕腥瞿训悖?1.判断该生成多少个图片框控件;2.如何不重复地把图片载入到图片框控件中;3.把所有这些图片框控件按顺序排列好。只要把这些问题解决了,其它的技术就不难了,对此我会在此文中一一介绍。
?牐犓盗四敲炊啵衷诶粗谱饕桓鍪道P陆ㄒ桓龉こ蹋袴orm1的Caption属性设置为”缩略图片浏览器”;BorderStyle属性设置为3-Fixed Dialog;WindowState属性设置为2-Maximized。再在其上分别放置一个PictureBox,一个DriveListBox,一个DirListBox,一个FileListBox,两个CommandButton控件和一个Image控件。
?牐犜闯绦蛉缦拢?
?牐燩rivate Sub Command1_Click?煟?
?牐牐б韵率恰?:预览”的代码
?牐燨n Error Resume Next
?牐燚im i As Integer
?牐燚im j As Integer
?牐爅 = File1.ListCount + 1
?牐營f Image1??2??.Visible = True Then
?牐燙all Command2_Click
?牐燛nd If
?牐燜or i = 1 To j
?牐燣oad Image1(i)
?牐營mage1(i).Visible = True
?牐營mage1(i).Left = Image1(i - 1).Left + 1400
?牐營mage1(i).Top = Image1(i - 1).Top
?牐營mage1(i- 1).Picture = LoadPicture(Dir1.Path + “\” + File1.List(i - 1))
?牐燚oEvents
?牐營f Image1(i).Left >= 10000 Then
?牐營mage1(i).Top = Image1(i - 1).Top + 1200
?牐營mage1(i).Left = Image1(0).Left
?牐燛nd If
?牐燦ext
?牐牐?判断是否有Image1控件被Picture1遮挡了
?牐營f (Image1(j - 3).Top + Image1(j - 3).Height) > Frame1.Height Then
?牐燜rame1.Height = Image1(j - 3).Top + Image1(j - 3).Height + 100
?牐燛nd If
?牐燰Scroll1.Max = Frame1.Height - Picture1.Height
?牐燛nd Sub
?牐燩rivate Sub Command2_Click()
?牐燚im i As Integer
?牐燜or i = 1 To Image1.Count - 1
?牐燯nload Image1(i)
?牐燦ext
?牐營mage1(0).Picture = LoadPicture(“”)
?牐燰Scroll1.Max = 0
?牐燛nd Sub
?牐燩rivate Sub Dir1_Change()
?牐燜ile1.Path = Dir1.Path
?牐燛nd Sub
?牐燩rivate Sub Drive1_Change()
?牐燚ir1.Path = Drive1.Drive
?牐燛nd Sub
?牐燩rivate Sub Form_Load()
?牐營mage1(0).Picture = LoadPicture(“”)
?牐燛nd Sub
?牐燩rivate Sub VScroll1_Change()
?牐燩icture2.Top = -VScroll1.Value
?牐燛nd Sub
?牐犚陨暇褪钦鋈砑脑闯绦颍匾牟糠衷谟贑ommand1_Click下的生成数组控件,请大家细看,好了,你可以生成你漂亮的软件了。