C++
送你段代碼: RECT rcWindow; GetClientRect(&rcWindow); DEVMODE devmode = {0}; devmode.dmSize = sizeof(DEVMODE); if(rcWindow.bottom>rcWindow.right) devmode.dmDisplayOrientation = DMDO_90; //水準模式 else devmode.dmDisplayOrientation = DMDO_0; devmode.dmFields = DM_DISPLAYORIENTATION; ChangeDisplaySettingsEx(NULL, &devmode, NULL, 0, NULL); |
C#
//http://bytes.com/topic/c-sharp/answers/249059-rotate-screen
I have a tablet PC and I write a application on this tablet PC, I would like to rotate the screen from portrait<->landscape mode(or 90/180/270 degree), what should I do?
I only find the code for pocket PC 2003 upgrade.
private void SetOrientation(ScreenOrientation so)
{
// Set the requested orientation.
SystemSettings.ScreenOrientation.Angle0 = so;
this.statusBar1.Text = SystemSettings.ScreenOrientation.ToString();
}