ScreenOrientation 列挙体
アセンブリ: Microsoft.WindowsCE.Forms (microsoft.windowsce.forms.dll 内)
構文
Public Enumeration ScreenOrientation
メンバ名 | 説明 | |
---|---|---|
Angle0 | 縦向き (角度 0 度) を指定します。 | |
Angle180 | 横向き (角度 180 度) を指定します。 | |
Angle270 | 向きを 270 度に指定します。 | |
Angle90 | 向きを 90 度に指定します。 |
縦向きの既定の角度は 0 度です。Pocket PC 2003 の更新が必要です。
ScreenOrientation 列挙体を使用して、ボタンをクリックしたときに画面の向きを回転させる方法を次のコード例に示します。このコード例は、SystemSettings クラスのトピックで取り上げているコード例の一部分です。
' Each click event changes the screen orientation, as determined ' by the variable x, which increments from 0 to 3 and then back ' to 0. Four clicks cycle through the ScreenOrientation enumeration. Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click Select Case x Case 0 ' Pass a value for the ScreenOrientation enumeration ' to the SetOrientation method, defined below, ' and increment x so that the next button ' click rotates the screen orientation. SetOrientation(ScreenOrientation.Angle90) x += 1 Case 1 SetOrientation(ScreenOrientation.Angle180) x += 1 Case 2 SetOrientation(ScreenOrientation.Angle270) x += 1 Case 3 SetOrientation(ScreenOrientation.Angle0) x = 0 Case Else SetOrientation(ScreenOrientation.Angle0) x = 0 End Select End Sub ' Set the orientation to a value of the ' ScreenOrienation enumeration and update the ' status bar with the current angle. Private Sub SetOrientation(so As ScreenOrientation) ' Set the requested orientation. SystemSettings.ScreenOrientation = so Me.StatusBar1.Text = SystemSettings.ScreenOrientation.ToString() End Sub
// Each click event changes the screen orientation, as determined // by the variable x, which increments from 0 to 3 and then back // to 0. Four clicks cycle through the ScreenOrientation enumeration. private void button1_Click(object sender, System.EventArgs e) { switch(x) { case 0: // Pass a value for the ScreenOrientation enumeration // to the SetOrientation method, defined below, // and increment x so that the next button // click rotates the screen orientation. SetOrientation(ScreenOrientation.Angle90); x++; break; case 1: SetOrientation(ScreenOrientation.Angle180); x++; break; case 2: SetOrientation(ScreenOrientation.Angle270); x++; break; case 3: SetOrientation(ScreenOrientation.Angle0); x = 0; break; default: SetOrientation(ScreenOrientation.Angle0); x = 0; break; } } // Set the orientation to a value of the // ScreenOrienation enumeration and update the // status bar with the current angle. private void SetOrientation(ScreenOrientation so) { // Set the requested orientation. SystemSettings.ScreenOrientation = so; this.statusBar1.Text = SystemSettings.ScreenOrientation.ToString(); }
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
ScreenOrientation 列挙体
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
Public Enumeration ScreenOrientation
解説
プラットフォーム
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- ScreenOrientationのページへのリンク