Freigeben über


Graphics.DpiX-Eigenschaft

Ruft die horizontale Auflösung dieses Graphics ab.

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

Syntax

'Declaration
Public ReadOnly Property DpiX As Single
'Usage
Dim instance As Graphics
Dim value As Single

value = instance.DpiX
public float DpiX { get; }
public:
property float DpiX {
    float get ();
}
/** @property */
public float get_DpiX ()
public function get DpiX () : float

Eigenschaftenwert

Der Wert in DPI (Dots Per Inch, Punkt pro Zoll) für die horizontale Auflösung, die dieses Graphics unterstützt.

Beispiel

Im folgenden Code wird die Verwendung der DpiX-Eigenschaft und der DpiY-Eigenschaft veranschaulicht. Dieses Beispiel ist für die Verwendung mit einem Windows Form vorgesehen. Um dieses Beispiel auszuführen, fügen Sie es in ein Formular ein, das eine ListBox mit dem Namen listBox1 enthält, und rufen Sie dann diese Methode im Konstruktor des Formulars auf.

Private Sub PopulateListBoxWithGraphicsResolution()
    Dim boxGraphics As Graphics = listBox1.CreateGraphics()
    Dim formGraphics As Graphics = Me.CreateGraphics()

    listBox1.Items.Add("ListBox horizontal resolution: " _
        & boxGraphics.DpiX)
    listBox1.Items.Add("ListBox vertical resolution: " _
        & boxGraphics.DpiY)

    boxGraphics.Dispose()
End Sub
private void PopulateListBoxWithGraphicsResolution()
{
    Graphics boxGraphics = listBox1.CreateGraphics();
    Graphics formGraphics = this.CreateGraphics();

    listBox1.Items.Add("ListBox horizontal resolution: " 
        + boxGraphics.DpiX);
    listBox1.Items.Add("ListBox vertical resolution: " 
        + boxGraphics.DpiY);

    boxGraphics.Dispose();
}
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

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

.NET Compact Framework

Unterstützt in: 2.0

Siehe auch

Referenz

Graphics-Klasse
Graphics-Member
System.Drawing-Namespace