public Int16 PaperSize;
public Int16 PaperLength;
public Int16 PaperWidth;
public Int16 Scale;
public Int16 Copies;
public Int16 DefaultSource;
public Int16 PrintQuality;
public Int16 Color;
public Int16 Duplex;
public Int16 Yresolution;
public Int16 TTOption;
public Int16 Collate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public String FormName;
public Int16 LogPixels;
public Int32 BitsPerPel;
public Int32 PelsWidth;
public Int32 PelsHeight;
public Int32 DisplayFlags;
public Int32 DisplayFrequency;
public Int32 DisplayOrientation;
}
private void butCheckRotate_Click(object sender, EventArgs e) {
// подготавливаем структуру DeviceMode
DeviceMode devMode = new DeviceMode();
devMode.Size = (Int16)Marshal.SizeOf(devMode);
devMode.Fields = DisplayQueryOrientation;
// Проверяем, поддерживает ли система поворот экрана
Int32 result =
ChangeDisplaySettingsEx(null, ref devMode, IntPtr.Zero, CDS_TEST,