Enumerasi ContextLinkDirection
Menentukan arah objek IContextLink .
Sintaks
typedef enum ContextLinkDirection {
ContextLinkDirection_LinksWith = 0,
ContextLinkDirection_LinksFrom = 1,
ContextLinkDirection_LinksTo = 2
} ContextLinkDirection;
Konstanta
-
ContextLinkDirection_LinksWith
-
IContextNode adalah gambar terarah yang menunjuk jauh dari IContextLink.
-
ContextLinkDirection_LinksFrom
-
IContextNode adalah gambar terarah yang menunjuk ke IContextLink.
-
ContextLinkDirection_LinksTo
-
Tidak ada gambar terarah di tautan. Misalnya, gambar tinta dapat menggaris bawahi kata tinta. Tidak ada arah yang disimpulkan dari garis bawah.
Contoh
Contoh berikut mengambil objek IContextNode , m_pSelectedNode
, dan menyimpan semua objek IContextNode yang ditautkannya dengan berjalan di pohon leluhur dan menambahkan objek ke dalam CArray
objek, linkedToNodes
. CheckHResult
adalah fungsi yang mengambil HRESULT
string dan , dan melemparkan pengecualian yang dibuat dengan string jika HRESULT
bukan BERHASIL.
// Find all first ancestor that contains links of type Enclose
CArray<IContextNode*,IContextNode*> linkedToNodes = CArray<IContextNode*,IContextNode*>();
IContextNode* pAncestor;
CheckHResult(m_pSelectedNode->GetParentNode(&pAncestor),
"IContextNode::GetParentNode failed");
while (pAncestor != NULL)
{
// Get the links
IContextLinks* pLinks;
CheckHResult(pAncestor->GetContextLinks(&pLinks),
"IContextNode::GetContextLinks failed");
ULONG nLinks;
CheckHResult(pLinks->GetCount(&nLinks), "IContextLinks::GetCount failed");
for (ULONG i = 0; i < nLinks; i++)
{
IContextLink* pLink;
CheckHResult(pLinks->GetContextLink(i, &pLink),
"IContextLinks::GetContextLink failed");
// Check link direction
ContextLinkDirection linkDirection;
CheckHResult(pLink->GetContextLinkDirection(&linkDirection),
"IContextLink:GetContextLinkDirection failed");
if (linkDirection == ContextLinkDirection_LinksTo)
{
// Get source node and add the array
IContextNode* pSourceNode;
CheckHResult(pLink->GetSourceNode(&pSourceNode),
"IContextLink::GetSourceNode failed");
linkedToNodes.Add(pSourceNode);
}
}
// Go up another level
IContextNode* pNewAncestor;
CheckHResult(pAncestor->GetParentNode(&pNewAncestor),
"IContextNode::GetParentNode failed");
pAncestor = pNewAncestor;
}
Persyaratan
Persyaratan | Nilai |
---|---|
Klien minimum yang didukung |
Windows XP Tablet PC Edition [hanya aplikasi desktop] |
Server minimum yang didukung |
Tidak ada yang didukung |
Header |
|
Lihat juga
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk