有谁做过这个的东东,预览某个文件夹下所有jpg图片,

解决方案 »

  1.   

    http://www.xuedelphi.cn/wenzhang/yytg/2008/12/200812282737.htm仅供参考
      

  2.   

    http://www.delphibbs.com/keylife/iblog_show.asp?xid=11899
      

  3.   

    我是想预览某个文件夹下面所有的jpg缩略图。不知道还有没有例子
      

  4.   


    procedure TfrmMineIntroduce.LoadLeaders;
    var
      i, v_iRow, v_iCol, v_iCurRow, v_iCurImg:Integer;
      fileCount:Integer;
    begin
      strList:=TstringList.Create;
      fileCount:=FindAllJPGFiles;
      if filecount>10 then
      begin
        btnimgup.Visible :=true;
        btnimgdown.Visible :=true;
      end;
      if fileCount<>0 then      //调用找JPG的函数
      begin
        v_iRow := Ceil(fileCount/5);
        v_iCol := fileCount mod 5;
        v_rowcount:=v_iRow;
        v_curRowCount:=1;
        v_iCurRow := 0;
        v_iCurImg := 0;
        while v_iCurRow <= v_iRow-1 do
        begin
        if (v_iCurRow = v_iRow-1) and (v_iCol<>0) then
          for i := 0 to v_iCol-1 do
          begin
            CreateImg(v_iCurRow,i,strlist.Strings[v_iCurImg],v_iCurImg);
            v_iCurImg := v_iCurImg + 1;
          end
        else
          for i := 0 to 4 do
          begin
            CreateImg(v_iCurRow,i,strlist.Strings[v_iCurImg],v_iCurImg);
            v_iCurImg := v_iCurImg + 1;
          end;
        v_iCurRow := v_iCurRow + 1;
        end;
      end
    end;
    function TfrmMineIntroduce.FindAllJPGFiles:Integer; //找到所有JPG图片名称
    var
      sr:TSearchRec;  GetImgList:TStringList;
      ImgCount:Integer;
      i:Integer;
    begin
     if findfirst(CommonPath+'\矿区简介\领导简介\*.JPG',faAnyFile,sr)=0 then   //找到第一张
      begin
        strList.Add(sr.name);
        while findnext(sr)=0 do  //继续找下一张
        begin
          strList.Add(sr.name);
        end;
        FindClose(sr);
        result:=strList.count;
      end
      else
        result:=0;  {GetImgList:=TStringList.Create;
      if findfirst(CommonPath+'\矿区简介\领导简介\*.JPG',faAnyFile,sr)=0 then   //找到第一张
      begin
        GetImgList.Add(sr.name);
        while findnext(sr)=0 do  //继续找下一张
        begin
          GetImgList.Add(sr.name);
        end;
        FindClose(sr);
        result:=GetImgList.count;
      end
      else
        result:=0;  for i:=0 to GetImgList.Count-1 do
      begin
        strList.Strings[strtoint(copy(GetImgList.Strings[i],1,2))-1]:=GetImgList.Strings[i];
      end;}end;
    procedure TfrmMineIntroduce.CreateImg(v_iRow, v_iCol:Integer;v_fsFileName:string;v_iCurImg:Integer);
    var
      img :TImage;
      lbl : TLabel;
      imgWidth, imgHeight: integer;
    begin
      imgWidth := 130;
      imgHeight := 180;
      img := TImage.Create(self);
      img.Parent := ScrollBox;
      img.Stretch := True;
      img.Width := imgWidth;
      img.Height := imgHeight;
      img.Top := v_iRow * (imgHeight + 90) +60;
      img.Left := v_iCol * (imgWidth + 20) + 10;
      img.Picture.LoadFromFile(CommonPath+'\矿区简介\领导简介\'+v_fsFileName);
      img.Tag:=v_iCurImg;
      img.OnClick := ImgClick;
      img.Cursor := crhandpoint;
      lbl := TLabel.Create(Self);
      lbl.Parent :=  ScrollBox;
      lbl.Alignment := taCenter;
      lbl.Width := imgWidth+20;
      lbl.Top := img.Top + imgHeight + 10;
      lbl.left := img.Left-10;
      lbl.AutoSize := False;
      lbl.Caption := copy(v_fsFileName,4,length(v_fsFileName)-8);
    end;这是我以前做的,工程你运行不了,所以只能给你相关代码,看不懂问我。
      

  5.   

    ImgClick; 
    看到你有这个函数,应该打开预览吧,虎滴小猪猪兄能给我看看这个函数不