Graphics.DpiX プロパティ

定義

この Graphicsの水平方向の解像度を取得します。

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

プロパティ値

この Graphicsでサポートされる水平方向の解像度の値 (1 インチあたりのドット数)。

次のメソッドは、 DpiX プロパティと DpiY プロパティの使用方法を示しています。 この例は、Windows フォームで使用するように設計されています。 この例を実行するには、listBox1 という名前の ListBox を含むフォームに貼り付け、フォームのコンストラクターからこのメソッドを呼び出します。

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

注釈

高解像度アプリケーションの作成の詳細については、以下を参照してください。

高 DPI

適用対象

こちらもご覧ください