Freigeben über


Graphics.PageUnit-Eigenschaft

Ruft die Maßeinheit für die Seitenkoordinaten in diesem Graphics ab oder legt diese fest.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

Syntax

'Declaration
Public Property PageUnit As GraphicsUnit
'Usage
Dim instance As Graphics
Dim value As GraphicsUnit

value = instance.PageUnit

instance.PageUnit = value
public GraphicsUnit PageUnit { get; set; }
public:
property GraphicsUnit PageUnit {
    GraphicsUnit get ();
    void set (GraphicsUnit value);
}
/** @property */
public GraphicsUnit get_PageUnit ()

/** @property */
public void set_PageUnit (GraphicsUnit value)
public function get PageUnit () : GraphicsUnit

public function set PageUnit (value : GraphicsUnit)

Eigenschaftenwert

Einer der GraphicsUnit-Werte.

Hinweise

Die Grafikeinheit ist die Maßeinheit für die Seitenkoordinaten in diesem Graphics.

Beispiel

Im folgenden Codebeispiel werden die Auswirkungen einer Änderung der PageUnit-Eigenschaft veranschaulicht.

Dieses Beispiel ist für die Verwendung mit Windows Forms vorgesehen. Fügen Sie den Code in ein Formular ein, und rufen Sie beim Behandeln des Paint-Ereignisses des Formulars die ChangePageUnit-Methode auf, wobei Sie e als PaintEventArgs übergeben.

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
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:
   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.get_Graphics().DrawRectangle(Pens.get_SlateBlue(), rectangle1);

    // Change the page scale.  
    e.get_Graphics().set_PageUnit(GraphicsUnit.Point);

    // Draw the rectangle again.
    e.get_Graphics().DrawRectangle(Pens.get_Tomato(), rectangle1);
} //ChangePageUnit

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

Graphics-Klasse
Graphics-Member
System.Drawing-Namespace