Graphics.PageUnit Właściwość

Definicja

Pobiera lub ustawia jednostkę miary używaną dla współrzędnych strony w tym obiekcie 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

Wartość właściwości

GraphicsUnit Jedna z wartości innych niż World.

Wyjątki

PageUnit jest ustawiona na Worldwartość , która nie jest jednostką fizyczną.

Przykłady

W poniższym przykładzie kodu pokazano efekt zmiany PageUnit właściwości.

Ten przykład jest przeznaczony do użycia z Windows Forms. Wklej kod do formularza i wywołaj ChangePageUnit metodę podczas obsługi zdarzenia formularza Paint , przekazując e go jako 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

Uwagi

Jednostka graficzna jest jednostką miary używaną dla współrzędnych strony w tym obiekcie Graphics.

Dotyczy

Zobacz też