Graphics.DpiX Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u de horizontale resolutie van deze Graphics.
public:
property float DpiX { float get(); };
public float DpiX { get; }
member this.DpiX : single
Public ReadOnly Property DpiX As Single
Waarde van eigenschap
De waarde, in punten per inch, voor de horizontale resolutie die wordt ondersteund door deze Graphics.
Voorbeelden
De volgende methode toont het gebruik van de DpiX en DpiY eigenschappen. Dit voorbeeld is ontworpen voor gebruik met een Windows Formulier. Als u dit voorbeeld wilt uitvoeren, plakt u het in een formulier dat een ListBox benoemde listBox1 bevat en roept u deze methode aan vanuit de constructor van het formulier.
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
Opmerkingen
Zie voor meer informatie over het maken van toepassingen met hoge resolutie