请问此控件支持多少种图片类型,好像.jpg图片类型不支持,真是奇怪???

解决方案 »

  1.   

    image1.Picture.Bitmap.Assign(TBLOBField(query1.Fields[7]));
      

  2.   

    //BMP、JPEG图片存储
    var
      Str : String;
      Jpeg : TJPEGIMAGE;
    begin
      Formmain.opd_Photo.Filter := 'BMP files (*.bmp)|*.BMP|JPG files (*.jpg)|*.JPG';
      if Formmain.opd_Photo.Execute then
      begin
        if not FileExists(Formmain.opd_Photo.filename) then
        begin
          Application.MessageBox('您选择的文件不存在!','提示信息',$00001040);
          Exit;
        end;
        Str := ExtractFileExt(Formmain.opd_Photo.filename);
        Str := Copy(Str,2,3);
        if Str='bmp' then
          img_photo.Picture.Bitmap.LoadFromFile(Formmain.opd_Photo.FileName)
        else if (Str='jpg') or (Str='jpeg') then
        begin
          Jpeg := TJPEGIMAGE.Create;
          Jpeg.LoadFromFile(Formmain.opd_Photo.FileName);
          img_photo.Picture.Bitmap.Assign(Jpeg);
        end;
      end;
    end;