Graphics.DpiX プロパティ

定義

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

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

プロパティ値

この Graphics でサポートされる水平方向の解像度の値 (dpi)。

次のメソッドは、 プロパティと DpiY プロパティの使用方法をDpiX示しています。 この例は、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

適用対象

こちらもご覧ください