Ogólnie rzecz biorąc, maksymalna rozdzielczość jest rodzimą rozdzielczością dla wyświetlaczy LCD. Jednak nie zawsze tak jest. Jeśli uda nam się tam wykorzystać, wystarcza uzyskanie maksymalnych rezolucji.
Maksymalna rozdzielczość można uzyskać za pomocą:
[DllImport("user32.dll")]
private static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DeviceMode devMode);
/// <summary>
/// Gets the max resolution + refresh rate supported by specific display
/// </summary>
/// <param name="deviceName">Device name(System.Windows.Forms.Screen.DeviceName)</param>
/// <param name="dispWidth">Width of the display</param>
/// <param name="dispHeight">Height of the display</param>
/// <param name="refreshRate">Refresh rate of the display</param>
/// <returns></returns>
public static void GetMaxResolutionWithRefreshRate(string deviceName, out int dispWidth, out int dispHeight, out int refreshRate)
{
dispWidth = dispHeight = refreshRate = 0;
DeviceMode deviceMode = new DeviceMode();
for (int i = 0; Win32.EnumDisplaySettings(deviceName, i, ref deviceMode) != 0; i++)
{
if (deviceMode.dmPelsWidth > dispWidth || (deviceMode.dmPelsWidth == dispWidth && deviceMode.dmPelsHeight >= dispHeight && deviceMode.dmDisplayFrequency >= refreshRate))
{
dispWidth = deviceMode.dmPelsWidth;
dispHeight = deviceMode.dmPelsHeight;
refreshRate = deviceMode.dmDisplayFrequency;
}
}
}
public static void GetMaxResolutionWithRefreshRate(out int dispWidth, out int dispHeight, out int refreshRate)
{
GetMaxResolutionWithRefreshRate(null, out dispWidth, out dispHeight, out refreshRate);
}
trzeba podjąć w celu uwzględnienia proporcje kiedy narysować krzywą. –
C# nie jest istotne, używasz .NET i WinForm lub WPF. –
OK przepraszam, używam .NET z WPF. – Mathias