Share via


SystemSettings クラス

[このドキュメントはプレビュー版であり、後のリリースで変更されることがあります。 空白のトピックは、プレースホルダーとして挿入されています。]

デバイスのユーザー インターフェイス設定およびネイティブ Windows Embedded CE オペレーティング システム設定にアクセスできるようにします。

名前空間:  Microsoft.WindowsCE.Forms
アセンブリ:  Microsoft.WindowsCE.Forms (Microsoft.WindowsCE.Forms.dll 内)

構文

'宣言
Public NotInheritable Class SystemSettings
'使用
Dim instance As SystemSettings
public sealed class SystemSettings
public ref class SystemSettings sealed
[<SealedAttribute>]
type SystemSettings =  class end

解説

現在、このクラスで設定できるのは、ScreenOrientation プロパティおよび Platform プロパティの設定だけです。

デバイスの画面の向きを、既定の 0° の縦表示から 90°、180°、270° に順に回転し、最後に 0° に戻す方法を次のコード例に示します。ボタンをクリックするたびに、ScreenOrientation 列挙体を循環します。

Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports Microsoft.WindowsCE.Forms



PublicClass Form1
   Inherits System.Windows.Forms.Form
   PrivateWithEvents Button1 As System.Windows.Forms.Button
   Private mainMenu1 As System.Windows.Forms.MainMenu
   Private StatusBar1 As System.Windows.Forms.StatusBar

   ' Set a variable to be incremented by button clicks   ' that will change the orientation by rotating   ' through the ScreenOrientation enumeration.Private x AsInteger = 0


   PublicSubNew()
      InitializeComponent()

      Me.MinimizeBox = False
      ' Set the screen orientation to normal      ' and display the value on the status bar.
      SystemSettings.ScreenOrientation = ScreenOrientation.Angle0
      Me.StatusBar1.Text = SystemSettings.ScreenOrientation.ToString()
   EndSubProtectedOverridesSub Dispose(disposing AsBoolean)
      MyBase.Dispose(disposing)
   EndSubPrivateSub InitializeComponent()
      Me.Button1 = New System.Windows.Forms.Button()
      Me.StatusBar1 = New System.Windows.Forms.StatusBar()
      '      ' Button1      'Me.Button1.Location = New System.Drawing.Point(16, 128)
      Me.Button1.Text = "Rotate"      '      ' Form1      'Me.Controls.Add(Button1)
      Me.Controls.Add(StatusBar1)
      Me.Text = "Orientation Demo"EndSubSharedSub Main()
      Application.Run(New Form1())
   EndSub

   ' 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.PrivateSub Button1_Click(sender AsObject, e As System.EventArgs) Handles Button1.Click

      SelectCase 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
         CaseElse
            SetOrientation(ScreenOrientation.Angle0)
            x = 0
      EndSelectEndSub

   ' Set the orientation to a value of the   ' ScreenOrienation enumeration and update the   ' status bar with the current angle.PrivateSub SetOrientation(so As ScreenOrientation)
      ' Set the requested orientation.
      SystemSettings.ScreenOrientation = so

      Me.StatusBar1.Text = SystemSettings.ScreenOrientation.ToString()
   EndSubEndClass
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using Microsoft.WindowsCE.Forms;

namespace SystemSettingsTest
{
publicclass Form1 : System.Windows.Forms.Form
{
 private System.Windows.Forms.Button button1;
 private System.Windows.Forms.MainMenu mainMenu1;
 private System.Windows.Forms.StatusBar statusBar1;

 // Set a variable to be incremented by button clicks// that will change the orientation by rotating// through the ScreenOrientation enumeration.int x = 0;

 public Form1()
 {
  InitializeComponent();

  this.MinimizeBox = false;

  // Set the screen orientation to normal// and display the value on the status bar.
  SystemSettings.ScreenOrientation = ScreenOrientation.Angle0;
  this.statusBar1.Text = SystemSettings.ScreenOrientation.ToString();

 }
 protectedoverridevoid Dispose( bool disposing )
 {
  base.Dispose( disposing );
 }
 #region Windows Form Designer generated code
 privatevoid InitializeComponent()
 {
  this.mainMenu1 = new System.Windows.Forms.MainMenu();
  this.button1 = new System.Windows.Forms.Button();
  this.statusBar1 = new System.Windows.Forms.StatusBar();
  //// button1//this.button1.Location = new System.Drawing.Point(16, 128);
  this.button1.Text = "Rotate";
  this.button1.Click += new System.EventHandler(this.button1_Click);
  //// Form1//this.Controls.Add(this.button1);
  this.Controls.Add(this.statusBar1);
  this.Menu = this.mainMenu1;
  this.Text = "Orientation Demo";
 }
 #endregion
 staticvoid Main()
 {
  Application.Run(new Form1());
 }


  // 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.privatevoid 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.privatevoid SetOrientation(ScreenOrientation so)
 {
  // Set the requested orientation.

  SystemSettings.ScreenOrientation = so;

  this.statusBar1.Text = SystemSettings.ScreenOrientation.ToString();
 }

継承階層

System.Object
  Microsoft.WindowsCE.Forms.SystemSettings

スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバーは、スレッド セーフです。 インスタンス メンバーの場合は、スレッド セーフであるとは限りません。

プラットフォーム

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。 サポートされているバージョンについては、「.NET フレームワークのシステム要件」を参照してください。

バージョン情報

.NET Compact Framework

サポート対象 : 3.5、2.0

参照

参照

SystemSettings メンバー

Microsoft.WindowsCE.Forms 名前空間

その他の技術情報

方法 : 印刷の向きと解像度の変更を処理します。