Definisce una forma geometrica, descritta utilizzando un oggetto StreamGeometryContext. Questa geometria è un'alternativa semplificata a PathGeometry: non supporta l'associazione dati, l'animazione, o la modifica.
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Freezable
System.Windows.Media.Animation.Animatable
System.Windows.Media.Geometry
System.Windows.Media.StreamGeometry
Spazio dei nomi: System.Windows.Media
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS per XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
<TypeConverterAttribute(GetType(GeometryConverter))> _ Public NotInheritable Class StreamGeometry _ Inherits Geometry
[TypeConverterAttribute(typeof(GeometryConverter))] public sealed class StreamGeometry : Geometry
[TypeConverterAttribute(typeof(GeometryConverter))] public ref class StreamGeometry sealed : public Geometry
[<Sealed>] [<TypeConverterAttribute(typeof(GeometryConverter))>] type StreamGeometry = class inherit Geometry end
<StreamGeometry .../>
<object property="moveAndDrawCommands"/>
Valor XAML
Il tipo StreamGeometry espone i seguenti membri.
| Nome | Descrizione | |
|---|---|---|
|
StreamGeometry | Inizializza una nuova istanza vuota della classe StreamGeometry. |
| Nome | Descrizione | |
|---|---|---|
|
Bounds | Ottiene un oggetto Rect le cui dimensioni sono esattamente sufficienti a contenere l'oggetto StreamGeometry. (Esegue l'override di Geometry.Bounds). |
|
CanFreeze | Ottiene un valore che indica se è possibile rendere immodificabile l’oggetto. (Ereditato da Freezable) |
|
DependencyObjectType | Ottiene la classe DependencyObjectType che include il tipo CLR di questa istanza. (Ereditato da DependencyObject) |
|
Dispatcher | Ottiene l'oggetto Dispatcher associato a DispatcherObject. (Ereditato da DispatcherObject) |
|
FillRule | Ottiene o imposta un valore che determina il modo in cui le aree di intersezione contenute nell'oggetto StreamGeometry vengono combinate. |
|
HasAnimatedProperties | Ottiene un valore che indica se uno o più oggetti AnimationClock sono associati a una qualsiasi delle proprietà di dipendenza di questo oggetto. (Ereditato da Animatable) |
|
IsFrozen | Ottiene un valore che indica se l’oggetto è attualmente immodificabile. (Ereditato da Freezable) |
|
IsSealed | Ottiene un valore che indica se l'istanza è attualmente sealed (di sola lettura). (Ereditato da DependencyObject) |
|
Transform | Ottiene o imposta l'oggetto Transform applicato a un oggetto Geometry. (Ereditato da Geometry) |
| Nome | Descrizione | |
|---|---|---|
|
ApplyAnimationClock(DependencyProperty, AnimationClock) | Applica un oggetto AnimationClock all'oggetto DependencyProperty specificato. Se alla proprietà è già stata aggiunta un'animazione, viene utilizzato il comportamento uniforme dell'oggetto SnapshotAndReplace. (Ereditato da Animatable) |
|
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior) | Applica un oggetto AnimationClock all'oggetto DependencyProperty specificato. Se alla proprietà è già stata aggiunta un'animazione, viene utilizzato l'oggetto HandoffBehavior specificato. (Ereditato da Animatable) |
|
BeginAnimation(DependencyProperty, AnimationTimeline) | Applica un'animazione all'oggetto DependencyProperty specificato. L'animazione viene avviata quando si esegue il rendering del fotogramma successivo. Se alla proprietà specificata è già stata aggiunta un'animazione, viene utilizzato il comportamento uniforme dell'oggetto SnapshotAndReplace. (Ereditato da Animatable) |
|
BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior) | Applica un'animazione all'oggetto DependencyProperty specificato. L'animazione viene avviata quando si esegue il rendering del fotogramma successivo. Se alla proprietà specificata è già stata aggiunta un'animazione, viene utilizzato l'oggetto HandoffBehavior specificato. (Ereditato da Animatable) |
|
CheckAccess | Determina se il thread chiamante ha accesso a DispatcherObject. (Ereditato da DispatcherObject) |
|
Clear | Consente di rimuovere tutte le informazioni geometriche dall'oggetto StreamGeometry. |
|
ClearValue(DependencyProperty) | Cancella il valore locale di una proprietà. La proprietà da cancellare è indicata da un identificatore DependencyProperty. (Ereditato da DependencyObject) |
|
ClearValue(DependencyPropertyKey) | Cancella il valore locale di una proprietà di sola lettura. La proprietà da cancellare è indicata da un identificatore DependencyPropertyKey. (Ereditato da DependencyObject) |
|
Clone | Crea un duplicato modificabile dell'oggetto StreamGeometry, eseguendo copie complete dei valori di tale oggetto. Durante la copia delle proprietà di dipendenza, vengono copiati i riferimenti di risorsa e le associazioni dati (che potrebbero non essere più risolti), ma non le animazioni o i relativi valori correnti. |
|
CloneCore | Si prenda ad esempio un clone (copia completa) di Freezable specificato utilizzando valori della proprietà di base (non-animati). (Ereditato da Freezable) |
|
CloneCurrentValue | Crea un duplicato modificabile dell'oggetto StreamGeometry, eseguendo copie complete dei valori correnti di tale oggetto. I riferimenti di risorsa, le associazioni dati e le animazioni non vengono copiati, mentre vengono copiati i relativi valori correnti. |
|
CloneCurrentValueCore | Rende l’istanza una copia modificabile (copia completa) dell'oggetto Freezable specificato utilizzando i valori della proprietà correnti. (Ereditato da Freezable) |
|
CoerceValue | Assegna il valore della proprietà di dipendenza specificata. Questa operazione viene eseguita richiamando qualsiasi funzione CoerceValueCallback specificata nei metadati della proprietà di dipendenza, esistente nell'oggetto DependencyObject chiamante. (Ereditato da DependencyObject) |
|
CreateInstance | Inizializza una nuova istanza della classe Freezable. (Ereditato da Freezable) |
|
CreateInstanceCore | Quando è implementato in una classe derivata, crea una nuova istanza della classe derivata Freezable. (Ereditato da Freezable) |
|
Equals | Determina se l'oggetto DependencyObject specificato equivale all'oggetto DependencyObject corrente. (Ereditato da DependencyObject) |
|
FillContains(Geometry) | Indica se la geometria corrente contiene completamente l'oggetto Geometry specificato. (Ereditato da Geometry) |
|
FillContains(Point) | Indica se la geometria contiene o meno l'oggetto Point specificato. (Ereditato da Geometry) |
|
FillContains(Geometry, Double, ToleranceType) | Indica se la geometria corrente contiene o meno l'oggetto Geometry specificato, in base al margine di errore definito. (Ereditato da Geometry) |
|
FillContains(Point, Double, ToleranceType) | Indica se la geometria contiene o meno l'oggetto Point specificato in base al margine di errore definito. (Ereditato da Geometry) |
|
FillContainsWithDetail(Geometry) | Restituisce un valore che descrive l'intersezione tra la geometria corrente e la geometria specificata. (Ereditato da Geometry) |
|
FillContainsWithDetail(Geometry, Double, ToleranceType) | Restituisce un valore che descrive l'intersezione tra la geometria corrente e la geometria specificata in base al margine di errore definito. (Ereditato da Geometry) |
|
Finalize | Consente a un oggetto di provare a liberare risorse ed eseguire altre operazioni di pulitura prima che l'oggetto stesso venga recuperato dalla procedura di Garbage Collection. (Ereditato da Object) |
|
Freeze() | Rende immodificabile l'oggetto corrente e imposta la proprietà IsFrozen su true. (Ereditato da Freezable) |
|
FreezeCore | Rende immodificabile questo oggetto Animatable o determina se l'oggetto può essere reso immodificabile. (Ereditato da Animatable) |
|
GetAnimationBaseValue | Restituisce il valore non animato dell'oggetto DependencyProperty specificato. (Ereditato da Animatable) |
|
GetArea() | Ottiene l'area riempita dell'oggetto Geometry. (Ereditato da Geometry) |
|
GetArea(Double, ToleranceType) | Ottiene l'area riempita dell'oggetto Geometry nell'ambito della tolleranza specificata. (Ereditato da Geometry) |
|
GetAsFrozen | Crea una copia bloccata di Freezable, utilizzando valori delle proprietà di base (non-animati). Dato che la copia è bloccata, gli oggetti secondari bloccati sono copiati dal riferimento. (Ereditato da Freezable) |
|
GetAsFrozenCore | Si prenda ad esempio una copia bloccata di Freezable specificato utilizzando valori della proprietà di base (non-animati). (Ereditato da Freezable) |
|
GetCurrentValueAsFrozen | Crea una copia bloccata di Freezable utilizzando valori della proprietà correnti. Dato che la copia è bloccata, gli oggetti secondari bloccati sono copiati dal riferimento. (Ereditato da Freezable) |
|
GetCurrentValueAsFrozenCore | Rende l’istanza corrente una copia bloccata di Freezablespecificato. Se l'oggetto dispone di proprietà di dipendenza animate, i valori animati correnti vengono copiati. (Ereditato da Freezable) |
|
GetFlattenedPathGeometry() | Ottiene un oggetto PathGeometry, ovvero un'approssimazione poligonale dell'oggetto Geometry. (Ereditato da Geometry) |
|
GetFlattenedPathGeometry(Double, ToleranceType) | Ottiene un oggetto PathGeometry, ovvero un'approssimazione poligonale dell'oggetto Geometry, nell'ambito della tolleranza specificata. (Ereditato da Geometry) |
|
GetHashCode | Ottiene un codice hash per questo oggetto DependencyObject. (Ereditato da DependencyObject) |
|
GetLocalValueEnumerator | Crea un enumeratore specializzato per determinare le proprietà di dipendenza che presentano valori impostati localmente nell'oggetto DependencyObject. (Ereditato da DependencyObject) |
|
GetOutlinedPathGeometry() | Ottiene un oggetto PathGeometry, ovvero una struttura semplificata dell'area riempita dell'oggetto Geometry. (Ereditato da Geometry) |
|
GetOutlinedPathGeometry(Double, ToleranceType) | Ottiene un oggetto PathGeometry, ovvero una struttura semplificata dell'area riempita dell'oggetto Geometry, nell'ambito della tolleranza specificata. (Ereditato da Geometry) |
|
GetRenderBounds(Pen) | Restituisce un rettangolo allineato all'asse sufficientemente grande da contenere la geometria delineata con l'oggetto Pen specificato. (Ereditato da Geometry) |
|
GetRenderBounds(Pen, Double, ToleranceType) | Restituisce un rettangolo allineato all'asse sufficientemente grande da contenere la geometria delineata con l'oggetto Pen specificato, in base al fattore di tolleranza definito. (Ereditato da Geometry) |
|
GetType | Ottiene l'oggetto Type dell'istanza corrente. (Ereditato da Object) |
|
GetValue | Restituisce il valore effettivo corrente di una proprietà di dipendenza in questa istanza di DependencyObject. (Ereditato da DependencyObject) |
|
GetWidenedPathGeometry(Pen) | Ottiene un oggetto PathGeometry, ovvero la forma definita dal tratto sull'oggetto Geometry prodotto dall'oggetto Pen specificato. (Ereditato da Geometry) |
|
GetWidenedPathGeometry(Pen, Double, ToleranceType) | Ottiene un oggetto PathGeometry, ovvero la forma definita dal tratto sull'oggetto Geometry prodotto dall'oggetto Pen specificato, in base al fattore di tolleranza definito. (Ereditato da Geometry) |
|
InvalidateProperty | Valuta di nuovo il valore effettivo della proprietà di dipendenza specificata. (Ereditato da DependencyObject) |
|
IsEmpty | Determina se StreamGeometry descrive una forma geometrica. (Esegue l'override di Geometry.IsEmpty()). |
|
MayHaveCurves | Determina se l'oggetto StreamGeometry contiene o meno segmenti curvi. (Esegue l'override di Geometry.MayHaveCurves()). |
|
MemberwiseClone | Consente di creare una copia dei riferimenti dell'oggetto Object corrente. (Ereditato da Object) |
|
OnChanged | Viene chiamato quando l'oggetto Freezable corrente viene modificato. (Ereditato da Freezable) |
|
OnFreezablePropertyChanged(DependencyObject, DependencyObject) | Assicura che adatti puntatori del contesto siano stabiliti per un membro dati DependencyObjectType che è appena stato impostato. (Ereditato da Freezable) |
|
OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) | Questo membro supporta l'infrastruttura Windows Presentation Foundation (WPF) e non può essere utilizzato direttamente dal codice. (Ereditato da Freezable) |
|
OnPropertyChanged | Esegue l'override dell'implementazione DependencyObject di OnPropertyChanged per richiamare anche qualsiasi gestore Changed in risposta a una modifica della proprietà di dipendenza di tipo Freezable. (Ereditato da Freezable) |
|
Open | Apre un oggetto StreamGeometryContext che può essere utilizzato per descrivere i contenuti StreamGeometry di questo oggetto. |
|
ReadLocalValue | Restituisce il valore locale di una proprietà di dipendenza, se esistente. (Ereditato da DependencyObject) |
|
ReadPreamble | Assicura che l’accesso di Freezable sia stato eseguito da un thread valido. Gli eredi di Freezable devono chiamare questo metodo all'inizio di qualsiasi API che legge i membri dei dati che non sono proprietà della dipendenza. (Ereditato da Freezable) |
|
SetCurrentValue | Imposta il valore di una proprietà di dipendenza senza modificare l'origine del valore. (Ereditato da DependencyObject) |
|
SetValue(DependencyProperty, Object) | Imposta il valore locale di una proprietà di dipendenza, specificata dal relativo identificatore. (Ereditato da DependencyObject) |
|
SetValue(DependencyPropertyKey, Object) | Imposta il valore locale di una proprietà di dipendenza di sola lettura, specificata dall'identificatore DependencyPropertyKey della proprietà di dipendenza. (Ereditato da DependencyObject) |
|
ShouldSerializeProperty | Restituisce un valore che indica se i processi di serializzazione devono serializzare il valore della proprietà di dipendenza fornita. (Ereditato da DependencyObject) |
|
ShouldSerializeTransform | Ottiene un valore che indica se il valore della proprietà Transform deve essere serializzato. (Ereditato da Geometry) |
|
StrokeContains(Pen, Point) | Determina se l'oggetto Point specificato è contenuto o meno nel tratto prodotto applicando l'oggetto Pen specificato alla geometria. (Ereditato da Geometry) |
|
StrokeContains(Pen, Point, Double, ToleranceType) | Determina se l'oggetto Point specificato è contenuto o meno nel tratto prodotto applicando l'oggetto Pen specificato alla geometria, in base al margine di errore definito. (Ereditato da Geometry) |
|
StrokeContainsWithDetail(Pen, Geometry) | Restituisce un valore che descrive l'intersezione tra l'oggetto Geometry specificato e il tratto creato applicando l'oggetto Pen specificato alla geometria corrente. (Ereditato da Geometry) |
|
StrokeContainsWithDetail(Pen, Geometry, Double, ToleranceType) | Ottiene un valore che descrive l'intersezione tra l'oggetto Geometry specificato e il tratto creato applicando l'oggetto Pen specificato alla geometria corrente, in base al margine di errore definito (Ereditato da Geometry) |
|
ToString() | Crea una rappresentazione di stringa dell'oggetto in base alle impostazioni cultura correnti. (Ereditato da Geometry) |
|
ToString(IFormatProvider) | Crea una rappresentazione di stringa dell'oggetto utilizzando le informazioni di formattazione specifiche delle impostazioni cultura specificate. (Ereditato da Geometry) |
|
VerifyAccess | Impone che il thread chiamante abbia accesso a DispatcherObject. (Ereditato da DispatcherObject) |
|
WritePostscript | Genera l'evento Changed per Freezable e richiama il metodo OnChanged. Le classi che derivano da Freezable devono chiamare questo metodo alla fine di qualsiasi API che modifica i membri della classe non archiviati come proprietà di dipendenza. (Ereditato da Freezable) |
|
WritePreamble | Verifica che l'oggetto Freezable non sia bloccato e che l'accesso sia eseguito da un contesto di threading valido. Gli eredi di Freezable devono chiamare questo metodo all'inizio di qualsiasi API che scrive sui membri dei dati che non sono proprietà della dipendenza. (Ereditato da Freezable) |
| Nome | Descrizione | |
|---|---|---|
|
Changed | Si verifica quando Freezable o un oggetto che contiene è modificato. (Ereditato da Freezable) |
| Nome | Descrizione | |
|---|---|---|
|
FillRuleProperty | Identifica la proprietà di dipendenza FillRule. |
| Nome | Descrizione | |
|---|---|---|
|
IFormattable.ToString | Formatta il valore dell'istanza corrente utilizzando il formato specificato. (Ereditato da Geometry) |
Utilizzare StreamGeometry per descrivere una geometria complessa senza il sovraccarico dovuto al supporto dell'associazione dati, dell'animazione o della modifica. Grazie alla sua efficienza, la classe StreamGeometry rappresenta una scelta ottimale per la descrizione degli strumenti decorativi visuali.
Non è possibile serializzare un oggetto StreamGeometry se esso include un oggetto Transform oppure segmenti non tracciati o non riempiti.
Funzionalità dell'oggetto Freezable
Una classe StreamGeometry è di tipo Freezable. Per informazioni sulle funzionalità di Freezable, quali il blocco e la clonazione, vedere Freezable Objects Overview.
StreamGeometry is light-weight alternative to PathGeometry for creating geometric shapes. Use a StreamGeometry when you need to describe a complex geometry but do not want the overhead of supporting data binding, animation, or modification. For example, because of its efficiency, the StreamGeometry class is a good choice for describing adorners.
The following example uses attribute syntax to create a triangular StreamGeometry in XAML.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <StackPanel> <Path Data="F0 M10,100 L100,100 100,50Z" StrokeThickness="1" Stroke="Black"/> </StackPanel> </Page>
For more information about StreamGeometry attribute syntax, see the Path Markup Syntax page.
The next example uses a StreamGeometry to define a triangle in code. First, the example creates a StreamGeometry, then obtains a StreamGeometryContext and uses it to describe the triangle.
Imports System Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Media Imports System.Windows.Shapes Namespace SDKSample ' Use StreamGeometry with StreamGeometryContext to define a triangle shape. Partial Public Class StreamGeometryTriangleExample Inherits Page Public Sub New() ' Create a path to draw a geometry with. Dim myPath As New Path() myPath.Stroke = Brushes.Black myPath.StrokeThickness = 1 ' Create a StreamGeometry to use to specify myPath. Dim geometry As New StreamGeometry() geometry.FillRule = FillRule.EvenOdd ' Open a StreamGeometryContext that can be used to describe this StreamGeometry ' object's contents. Using ctx As StreamGeometryContext = geometry.Open() ' Begin the triangle at the point specified. Notice that the shape is set to ' be closed so only two lines need to be specified below to make the triangle. ctx.BeginFigure(New Point(10, 100), True, True) ' is closed - is filled ' Draw a line to the next specified point. ctx.LineTo(New Point(100, 100), True, False) ' is smooth join - is stroked ' Draw another line to the next specified point. ctx.LineTo(New Point(100, 50), True, False) ' is smooth join - is stroked End Using ' Freeze the geometry (make it unmodifiable) ' for additional performance benefits. geometry.Freeze() ' Specify the shape (triangle) of the Path using the StreamGeometry. myPath.Data = geometry ' Add path shape to the UI. Dim mainPanel As New StackPanel() mainPanel.Children.Add(myPath) Me.Content = mainPanel End Sub End Class End Namespace
using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Shapes; namespace SDKSample { // Use StreamGeometry with StreamGeometryContext to define a triangle shape. public partial class StreamGeometryTriangleExample : Page { public StreamGeometryTriangleExample() { // Create a path to draw a geometry with. Path myPath = new Path(); myPath.Stroke = Brushes.Black; myPath.StrokeThickness = 1; // Create a StreamGeometry to use to specify myPath. StreamGeometry geometry = new StreamGeometry(); geometry.FillRule = FillRule.EvenOdd; // Open a StreamGeometryContext that can be used to describe this StreamGeometry // object's contents. using (StreamGeometryContext ctx = geometry.Open()) { // Begin the triangle at the point specified. Notice that the shape is set to // be closed so only two lines need to be specified below to make the triangle. ctx.BeginFigure(new Point(10, 100), true /* is filled */, true /* is closed */); // Draw a line to the next specified point. ctx.LineTo(new Point(100, 100), true /* is stroked */, false /* is smooth join */); // Draw another line to the next specified point. ctx.LineTo(new Point(100, 50), true /* is stroked */, false /* is smooth join */); } // Freeze the geometry (make it unmodifiable) // for additional performance benefits. geometry.Freeze(); // Specify the shape (triangle) of the Path using the StreamGeometry. myPath.Data = geometry; // Add path shape to the UI. StackPanel mainPanel = new StackPanel(); mainPanel.Children.Add(myPath); this.Content = mainPanel; } } }
The next example creates a method that uses a StreamGeometry and StreamGeometryContext to define a geometric shape based on specified parameters.
Imports System Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Media Imports System.Windows.Shapes Namespace SDKSample Partial Public Class StreamGeometryExample Inherits Page Public Sub New() ' Create a path to draw a geometry with. Dim myPath As New Path() myPath.Stroke = Brushes.Black myPath.StrokeThickness = 1 ' Create a StreamGeometry to use to specify myPath. Dim theGeometry As StreamGeometry = BuildRegularPolygon(New Point(200, 200), 200, 8, 0) theGeometry.FillRule = FillRule.EvenOdd ' Freeze the geometry (make it unmodifiable) ' for additional performance benefits. theGeometry.Freeze() ' Use the StreamGeometry returned by the BuildRegularPolygon to ' specify the shape of the path. myPath.Data = theGeometry ' Add path shape to the UI. Dim mainPanel As New StackPanel() mainPanel.Children.Add(myPath) Me.Content = mainPanel End Sub Private Function BuildRegularPolygon(ByVal c As Point, ByVal r As Double, ByVal numSides As Integer, ByVal offsetDegree As Double) As StreamGeometry ' c is the center, r is the radius, ' numSides the number of sides, offsetDegree the offset in Degrees. ' Do not add the last point. Dim geometry As New StreamGeometry() Using ctx As StreamGeometryContext = geometry.Open() ctx.BeginFigure(New Point(), True, True) ' is closed - is filled Dim [step] As Double = 2 * Math.PI / Math.Max(numSides, 3) Dim cur As Point = c Dim a As Double = Math.PI * offsetDegree / 180.0 Dim i As Integer = 0 Do While i < numSides cur.X = c.X + r * Math.Cos(a) cur.Y = c.Y + r * Math.Sin(a) ctx.LineTo(cur, True, False) ' is smooth join - is stroked i += 1 a += [step] Loop End Using Return geometry End Function End Class End Namespace
using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Shapes; namespace SDKSample { public partial class StreamGeometryExample : Page { public StreamGeometryExample() { // Create a path to draw a geometry with. Path myPath = new Path(); myPath.Stroke = Brushes.Black; myPath.StrokeThickness = 1; // Create a StreamGeometry to use to specify myPath. StreamGeometry theGeometry = BuildRegularPolygon(new Point(200, 200), 200, 8, 0); theGeometry.FillRule = FillRule.EvenOdd; // Freeze the geometry (make it unmodifiable) // for additional performance benefits. theGeometry.Freeze(); // Use the StreamGeometry returned by the BuildRegularPolygon to // specify the shape of the path. myPath.Data = theGeometry; // Add path shape to the UI. StackPanel mainPanel = new StackPanel(); mainPanel.Children.Add(myPath); this.Content = mainPanel; } StreamGeometry BuildRegularPolygon(Point c, double r, int numSides, double offsetDegree) { // c is the center, r is the radius, // numSides the number of sides, offsetDegree the offset in Degrees. // Do not add the last point. StreamGeometry geometry = new StreamGeometry(); using (StreamGeometryContext ctx = geometry.Open()) { ctx.BeginFigure(new Point(), true /* is filled */, true /* is closed */); double step = 2 * Math.PI / Math.Max(numSides, 3); Point cur = c; double a = Math.PI * offsetDegree / 180.0; for (int i = 0; i < numSides; i++, a += step) { cur.X = c.X + r * Math.Cos(a); cur.Y = c.Y + r * Math.Sin(a); ctx.LineTo(cur, true /* is stroked */, false /* is smooth join */); } } return geometry; } } }
.NET Framework
Supportato in: 4, 3.5, 3.0.NET Framework Client Profile
Supportato in: 4, 3.5 SP1Windows 7, Windows Vista SP1 o versione successiva, Windows XP SP3, Windows Server 2008 (componenti di base del server non supportati), Windows Server 2008 R2 (componenti di base del server supportati con SP1 o versione successiva), Windows Server 2003 SP2
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.