Graphics.PageUnit Property
.NET Framework 3.0
Gets or sets the unit of measure used for page coordinates in this Graphics.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Assembly: System.Drawing (in system.drawing.dll)
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)
Not applicable.
Property Value
One of the GraphicsUnit values other than World.The following code example demonstrates the effect of changing the PageUnit property.
This example is designed to be used with Windows Forms. Paste the code into a form and call the ChangePageUnit method when handling the form's Paint event, passing e as 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.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
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: