Image::RemovePropertyItem 方法 (gdiplusheaders.h)

Image::RemovePropertyItem方法會從這個Image物件中移除屬性專案 (部分中繼資料) 。

語法

Status RemovePropertyItem(
  [in] PROPID propId
);

參數

[in] propId

類型: PROPID

整數,識別要移除的屬性專案。

傳回值

類型: 狀態

如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。

如果方法失敗,它會傳回 Status 列舉的其他其中一個專案。

備註

Image::RemovePropertyItem方法會從Image物件中移除指定的屬性,但該屬性專案不會從用來建構Image物件的檔案或資料流程中移除。 若要將影像 (,並將屬性專案移除) 儲存至新的 JPEG 檔案或資料流程,請呼叫Image物件的Save方法。

範例

下列範例會根據 JPEG 檔案建立 Image 物件。 程式碼會藉由呼叫Image::RemovePropertyItem方法,從Image物件中移除 PropertyTagEquipMake 屬性專案。 程式碼會呼叫 Image::GetPropertyItemSize 兩次, (移除專案之後) 一次,以判斷 PropertyTagEquipMake 屬性專案的大小。 程式碼不會從影像檔中移除屬性專案;它只會從 Image 物件中移除屬性專案。

#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;

INT main()
{
   GdiplusStartupInput gdiplusStartupInput;
   ULONG_PTR gdiplusToken;
   GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

   Image* image = new Image(L"FakePhoto3.jpg");
   UINT size = 0;

   size = image->GetPropertyItemSize(PropertyTagEquipMake);
   printf("The size of the PropertyTagEquipMake item is %u.\n", size);

   image->RemovePropertyItem(PropertyTagEquipMake);   

   size = image->GetPropertyItemSize(PropertyTagEquipMake);
   printf("The size of the PropertyTagEquipMake item is %u.\n", size);

   delete image;
   GdiplusShutdown(gdiplusToken);
   return 0;
}

上述程式碼以及特定檔案 FakePhoto3.jpg 會產生下列輸出:

The size of the PropertyTagEquipMake item is 33.
The size of the PropertyTagEquipMake item is 0.

需求

   
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限桌面應用程式]
最低支援的伺服器 Windows 2000 Server [僅限桌面應用程式]
目標平台 Windows
標頭 gdiplusheaders.h (包含 Gdiplus.h)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

映像

Image::GetAllPropertyItems

Image::GetPropertyCount

Image::GetPropertyIdList

Image::GetPropertyItem

Image::GetPropertyItemSize

Image::GetPropertySize

Image::SetPropertyItem

PropertyItem

讀取和寫入中繼資料