VisualStyleRenderer.IsElementDefined(VisualStyleElement) Metódus
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Meghatározza, hogy a megadott vizualizációstílus-elemet az aktuális vizualizációstílus határozza-e meg.
public:
static bool IsElementDefined(System::Windows::Forms::VisualStyles::VisualStyleElement ^ element);
public static bool IsElementDefined(System.Windows.Forms.VisualStyles.VisualStyleElement element);
static member IsElementDefined : System.Windows.Forms.VisualStyles.VisualStyleElement -> bool
Public Shared Function IsElementDefined (element As VisualStyleElement) As Boolean
Paraméterek
- element
- VisualStyleElement
Egy VisualStyleElement olyan osztály és alkatrész kombináció, amelynek az osztályát és a részkombinációját ellenőrzi a rendszer.
Válaszok
trueha a tulajdonságok és ClassName a Part tulajdonságok element kombinációja definiálva van; ellenkező esetben. false
Kivételek
Az operációs rendszer nem támogatja a vizuális stílusokat.
-vagy-
A vizuális stílusokat a felhasználó letiltja az operációs rendszerben.
-vagy-
A vizualizációs stílusok nincsenek alkalmazva az alkalmazásablakok ügyfélterületére.
Példák
Az alábbi példakód bemutatja, hogyan használható a IsElementDefined metódus annak meghatározására, hogy inicializálni kell-e egy VisualStyleRenderer adott VisualStyleElement. Ez a példakód egy nagyobb, az VisualStyleRenderer osztály áttekintéséhez megadott példa része.
// Set the VisualStyleRenderer to a new element.
private:
bool SetRenderer(VisualStyleElement^ element)
{
if (!VisualStyleRenderer::IsElementDefined(element))
{
return false;
}
if (renderer == nullptr)
{
renderer = gcnew VisualStyleRenderer(element);
}
else
{
renderer->SetParameters(element);
}
return true;
}
// Set the VisualStyleRenderer to a new element.
private bool SetRenderer(VisualStyleElement element)
{
if (!VisualStyleRenderer.IsElementDefined(element))
{
return false;
}
if (renderer == null)
{
renderer = new VisualStyleRenderer(element);
}
else
{
renderer.SetParameters(element);
}
return true;
}
' Set the VisualStyleRenderer to a new element.
Private Function SetRenderer(ByVal element As _
VisualStyleElement) As Boolean
If Not VisualStyleRenderer.IsElementDefined(element) Then
Return False
End If
If renderer Is Nothing Then
renderer = New VisualStyleRenderer(element)
Else
renderer.SetParameters(element)
End If
Return True
End Function
Megjegyzések
Ez a módszer belsőleg ellenőrzi a IsSupported tulajdonság értékét.