Graphics.DpiX 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得此 Graphics物的水平解析度。
public:
property float DpiX { float get(); };
public float DpiX { get; }
member this.DpiX : single
Public ReadOnly Property DpiX As Single
屬性值
該值以每英吋點數表示,代表由此 Graphics支持的水平解析度。
範例
以下方法說明了 和 DpiX 屬性的使用DpiY。 此範例設計用於 Windows 表單。 要執行此範例,將它貼到包含 ListBox 一個名為 listBox1 的表單中,並從表單的建構子呼叫此方法。
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
備註
欲了解更多關於建立高解析度應用程式的資訊,請參閱