Bagikan melalui


IXpsOMObjectFactory::CreateSolidColorBrush method (xpsobjectmodel.h)

Membuat antarmuka IXpsOMSolidColorBrush , yang menentukan kuas dengan satu warna solid.

Sintaks

HRESULT CreateSolidColorBrush(
  [in]          const XPS_COLOR            *color,
  [in]          IXpsOMColorProfileResource *colorProfile,
  [out, retval] IXpsOMSolidColorBrush      **solidColorBrush
);

Parameter

[in] color

Struktur XPS_COLOR yang menentukan warna kuas.

[in] colorProfile

Antarmuka IXpsOMColorProfileResource . Kecuali jenis warnanya XPS_COLOR_TYPE_CONTEXT, nilai ini harus NULL.

[out, retval] solidColorBrush

Penunjuk ke antarmuka IXpsOMSolidColorBrush baru.

Nilai kembali

Metode mengembalikan HRESULT. Nilai yang mungkin termasuk, tetapi tidak terbatas pada, yang ada dalam tabel berikut. Untuk informasi tentang nilai pengembalian API dokumen XPS yang tidak tercantum dalam tabel ini, lihat Kesalahan Dokumen XPS.

Menampilkan kode Deskripsi
S_OK
Metode berhasil.
E_POINTER
warna atau solidColorBrush adalah NULL.
XPS_E_MISSING_COLORPROFILE
colorProfileADALAH NULL ketika profil warna diharapkan. Profil warna diperlukan saat jenis warna XPS_COLOR_TYPE_CONTEXT.
XPS_E_NO_CUSTOM_OBJECTS
colorProfile tidak menunjuk ke implementasi antarmuka yang dikenali. Implementasi kustom antarmuka XPS Document API tidak didukung.
XPS_E_UNEXPECTED_COLORPROFILE
colorProfile berisi profil warna ketika tidak diharapkan. Profil warna hanya diperlukan saat jenis warna XPS_COLOR_TYPE_CONTEXT.

Keterangan

Contoh kode yang mengikuti menggambarkan bagaimana metode ini digunakan untuk membuat antarmuka baru.


IXpsOMSolidColorBrush             *newInterface;
// The following values are defined outside of 
// this example.
//  XPS_COLOR                     color;
//  IXpsOMColorProfileResource    *colorProfile;

// Note the implicit requirement that CoInitializeEx 
//  has previously been called from this thread.

hr = CoCreateInstance(
    __uuidof(XpsOMObjectFactory),
    NULL,
    CLSCTX_INPROC_SERVER,
    _uuidof(IXpsOMObjectFactory),
    reinterpret_cast<LPVOID*>(&xpsFactory)
    );

if (SUCCEEDED(hr))
{
    hr = xpsFactory->CreateSolidColorBrush (
        &color,
        colorProfile,
        &newInterface);

    if (SUCCEEDED(hr))
    {
        // use newInterface

        newInterface->Release();
    }
    xpsFactory->Release();
}
else
{
    // evaluate HRESULT error returned in hr
}

Persyaratan

Persyaratan Nilai
Klien minimum yang didukung Windows 7, Windows Vista dengan SP2 dan Pembaruan Platform untuk Windows Vista [aplikasi desktop | Aplikasi UWP]
Server minimum yang didukung Windows Server 2008 R2, Windows Server 2008 dengan SP2 dan Pembaruan Platform untuk Windows Server 2008 [aplikasi desktop | Aplikasi UWP]
Target Platform Windows
Header xpsobjectmodel.h

Lihat juga

IXpsOMColorProfileResource

IXpsOMObjectFactory

IXpsOMSolidColorBrush

Spesifikasi Kertas XML

Kesalahan Dokumen XPS

XPS_COLOR