Graphics.DpiX Eigenschaft

Definition

Ruft die horizontale Auflösung dieses Graphics ab.

public:
 property float DpiX { float get(); };
public float DpiX { get; }
member this.DpiX : single
Public ReadOnly Property DpiX As Single

Eigenschaftswert

Der Wert in dpi (Punkte pro Zoll) für die horizontale Auflösung, die durch dieses Graphics unterstützt wird.

Beispiele

Die folgende Methode zeigt die Verwendung der DpiX Eigenschaften und DpiY . Dieses Beispiel ist für die Verwendung mit einem Windows Form-Formular konzipiert. Um dieses Beispiel auszuführen, fügen Sie es in ein Formular ein, das einen ListBox benannten listBox1 enthält, und rufen Sie diese Methode aus dem Konstruktor des Formulars auf.

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.Items.Add("ListBox horizontal resolution: " 
        + boxGraphics.DpiX);
    listBox1.Items.Add("ListBox vertical resolution: " 
        + boxGraphics.DpiY);

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

Hinweise

Weitere Informationen zum Erstellen von Anwendungen mit hoher Auflösung finden Sie unter

Hoher DPI-Wert.

Gilt für:

Weitere Informationen