Graphics.PageUnit Proprietà

Definizione

Ottiene o imposta l'unità di misura usata per le coordinate di pagina in questo oggetto Graphics.

public:
 property System::Drawing::GraphicsUnit PageUnit { System::Drawing::GraphicsUnit get(); void set(System::Drawing::GraphicsUnit value); };
public System.Drawing.GraphicsUnit PageUnit { get; set; }
member this.PageUnit : System.Drawing.GraphicsUnit with get, set
Public Property PageUnit As GraphicsUnit

Valore della proprietà

Uno dei valori di GraphicsUnit diverso da World.

Eccezioni

La proprietà PageUnit è impostata su World che non corrisponde a un'unità fisica.

Esempio

Nell'esempio di codice seguente viene illustrato l'effetto della modifica della PageUnit proprietà.

Questo esempio è progettato per essere usato con Windows Forms. Incollare il codice in un modulo e chiamare il ChangePageUnit metodo durante la gestione dell'evento del Paint modulo, passando e come PaintEventArgs.

private:
   void ChangePageUnit( PaintEventArgs^ e )
   {
      // Create a rectangle.
      Rectangle rectangle1 = Rectangle(20,20,50,100);

      // Draw its outline.
      e->Graphics->DrawRectangle( Pens::SlateBlue, rectangle1 );

      // Change the page scale.  
      e->Graphics->PageUnit = GraphicsUnit::Point;

      // Draw the rectangle again.
      e->Graphics->DrawRectangle( Pens::Tomato, rectangle1 );
   }
private void ChangePageUnit(PaintEventArgs e)
{

    // Create a rectangle.
    Rectangle rectangle1 = new Rectangle(20, 20, 50, 100);

    // Draw its outline.
    e.Graphics.DrawRectangle(Pens.SlateBlue, rectangle1);

    // Change the page scale.  
    e.Graphics.PageUnit = GraphicsUnit.Point;

    // Draw the rectangle again.
    e.Graphics.DrawRectangle(Pens.Tomato, rectangle1);
}
Private Sub ChangePageUnit(ByVal e As PaintEventArgs)

    ' Create a rectangle.
    Dim rectangle1 As New Rectangle(20, 20, 50, 100)

    ' Draw its outline.
    e.Graphics.DrawRectangle(Pens.SlateBlue, rectangle1)

    ' Change the page scale.  
    e.Graphics.PageUnit = GraphicsUnit.Point

    ' Draw the rectangle again.
    e.Graphics.DrawRectangle(Pens.Tomato, rectangle1)

End Sub

Commenti

L'unità grafica è l'unità di misura utilizzata per le coordinate della pagina in questo Graphicsoggetto .

Si applica a

Vedi anche