Gambar::Metode RemovePropertyItem (gdiplusheaders.h)

Metode Image::RemovePropertyItem menghapus item properti (bagian metadata) dari objek Gambar ini.

Sintaks

Status RemovePropertyItem(
  [in] PROPID propId
);

Parameter

[in] propId

Jenis: PROPID

Bilangan bulat yang mengidentifikasi item properti yang akan dihapus.

Menampilkan nilai

Jenis: Status

Jika metode berhasil, metode mengembalikan Ok, yang merupakan elemen dari enumerasi Status .

Jika metode gagal, metode mengembalikan salah satu elemen lain dari enumerasi Status .

Keterangan

Metode Image::RemovePropertyItem menghapus properti tertentu dari objek Gambar , tetapi item properti tersebut tidak dihapus dari file atau aliran yang digunakan untuk membuat objek Gambar . Untuk menyimpan gambar (dengan item properti dihapus) ke file atau aliran JPEG baru, panggil metode Simpan objek Gambar .

Contoh

Contoh berikut membuat objek Gambar berdasarkan file JPEG. Kode menghapus item properti PropertyTagEquipMake dari objek Gambar dengan memanggil metode Image::RemovePropertyItem . Kode memanggil Image::GetPropertyItemSize dua kali (sekali sebelum dan sekali setelah menghapus item) untuk menentukan ukuran item properti PropertyTagEquipMake. Kode tidak menghapus item properti dari file gambar; ini menghapus item properti hanya dari objek Gambar .

#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;
}

Kode sebelumnya, bersama dengan file tertentu, FakePhoto3.jpg, menghasilkan output berikut:

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

Persyaratan

   
Klien minimum yang didukung Windows XP, Windows 2000 Professional [hanya aplikasi desktop]
Server minimum yang didukung Windows 2000 Server [hanya aplikasi desktop]
Target Platform Windows
Header gdiplusheaders.h (termasuk Gdiplus.h)
Pustaka Gdiplus.lib
DLL Gdiplus.dll

Lihat juga

Gambar

Gambar::GetAllPropertyItems

Gambar::GetPropertyCount

Gambar::GetPropertyIdList

Gambar::GetPropertyItem

Gambar::GetPropertyItemSize

Gambar::GetPropertySize

Gambar::SetPropertyItem

PropertyItem

Membaca dan Menulis Metadata