Graphics.DpiY Property
.NET Framework 3.0
Gets the vertical resolution of this Graphics.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Assembly: System.Drawing (in system.drawing.dll)
The following method shows the use of the DpiX and DpiY properties. This example is designed for use with a Windows Form. To run this example, paste it into a form that contains a ListBox named listBox1 and call this method from the form's constructor.
private: void PopulateListBoxWithGraphicsResolution() { Graphics^ boxGraphics = listBox1->CreateGraphics(); // Graphics* formGraphics = this->CreateGraphics(); listBox1->Items->Add( String::Format( "ListBox horizontal resolution: {0}", boxGraphics->DpiX ) ); listBox1->Items->Add( String::Format( "ListBox vertical resolution: {0}", boxGraphics->DpiY ) ); delete boxGraphics; }
private void PopulateListBoxWithGraphicsResolution()
{
Graphics boxGraphics = listBox1.CreateGraphics();
Graphics formGraphics = this.CreateGraphics();
listBox1.get_Items().Add(("ListBox horizontal resolution: "
+ boxGraphics.get_DpiX()));
listBox1.get_Items().Add(("ListBox vertical resolution: "
+ boxGraphics.get_DpiY()));
boxGraphics.Dispose();
} //PopulateListBoxWithGraphicsResolution
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, 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: