Q&A

  • bmp image is not a vaild라는 에러가 나는데.. 알려주세요..
bmp는 잘 되는데 jpeg만 않되거든요..

위의 에러가 나요 왜 나는 지 도저히 모르겠어요...

좀 알려주시면... ㅠㅠ.....

procedure TfrmMC1102A0.ImageList_Setup;
var
  I: Integer;
//  ListItem: TListItem;
//  NewColumn: TListColumn;
  Picture: TPicture;
  ImageField: TField;
begin
  //임시테이블
  CreateTable;

   FileListBox.ApplyFilePath('C:\MedicalDDX\Work\Image\Icon\');

   for i := 1 to FileListBox.Count do
   begin
      with dxDBGrid.DataSource.DataSet do
           try
              Append;
              ImageField := FindField('Picture');
              if ImageField <> nil then
              begin
                 Picture := TPicture.Create;
                 try
                   Picture.LoadFromFile(ICON_PATH + FileListBox.Items[i - 1]);
//                   colPictureAssignPicture(nil, Picture);
                   if Picture.Graphic is TBitmap then
                     ImageField.Assign(Picture)
                   else SaveGraphicToBlobField(Picture.Graphic, ImageField);

                   FieldByName('FileNM').AsString := FileListBox.Items[i - 1];
                   FieldByName('CHK'   ).AsString := 'False';
                 finally
                   Picture.Free;
                 end;
              end;
              Post;
           except
           end;
           //with ~~~~~~ 끝;
   end;
   cmbImgCHK  .Items.Clear;
end;
1  COMMENTS
  • Profile
    Crazy 2004.07.04 22:18
    bmp 파일이 아니라서 나는 에러같습니다.
    아래는 bitmap을 jpeg로 변환하는 것인데 반대로 수정하신 후
    파일로드후 bitmap이 아니면 변환시켜서 하면 될것입니다.
    그럼..

    //==================================================파일열기
    procedure TForm_CC03010.BitBtn_OpenClick(Sender: TObject);
    var
         Bit : TBitmap;
         Jp : TJPEGImage;
    begin
         if OpenPictureDialog1.Execute then
         begin
              Image_Open.Picture.LoadFromFile( OpenPictureDialog1.FileName );

              if Image_Open.Picture.Graphic is TJpegImage then
              begin
                   Exit;
              end;

              //================================== Bitmap Image => JpegImage Convert
              if Image_Open.Picture.Graphic is TBitmap then
              begin
                   JP := TJPEGImage.Create;
                   Bit := TBitmap.Create;

                   Bit.LoadFromFile( OpenPictureDialog1.FileName );
                   JP.Assign( TJPEGImage( Bit ) );

                   Image_Open.Picture.Graphic := JP;
                   Bit.Free;
                   JP.Free;
              end;
         end;

    end;