SystemPens クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
SystemPens クラスの各プロパティは、Windows表示要素の色であり、幅が 1 ピクセルの Pen です。
public ref class SystemPens sealed
public sealed class SystemPens
type SystemPens = class
Public NotInheritable Class SystemPens
- 継承
-
SystemPens
例
次のコード例では、これらの型に対して定義されているオーバーロードされた演算子をいくつか使用して、ポイントとサイズを作成します。 また、 SystemPens クラスの使用方法についても説明します。
この例は、Windows フォームで使用するように設計されています。
Buttonという名前のsubtractButtonを含むフォームを作成します。 コードをフォームに貼り付け、フォームの CreatePointsAndSizes イベント処理メソッドから Paint メソッドを呼び出し、eとしてPaintEventArgs渡します。
void CreatePointsAndSizes( PaintEventArgs^ e )
{
// Create the starting point.
Point startPoint = Point(subtractButton->Size);
// Use the addition operator to get the end point.
Point endPoint = startPoint + System::Drawing::Size( 140, 150 );
// Draw a line between the points.
e->Graphics->DrawLine( SystemPens::Highlight, startPoint, endPoint );
// Convert the starting point to a size and compare it to the
// subtractButton size.
System::Drawing::Size buttonSize = (System::Drawing::Size)startPoint;
if ( buttonSize == subtractButton->Size )
{
e->Graphics->DrawString( "The sizes are equal.", gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), Brushes::Indigo, 10.0F, 65.0F );
}
}
private void CreatePointsAndSizes(PaintEventArgs e)
{
// Create the starting point.
Point startPoint = new Point(subtractButton.Size);
// Use the addition operator to get the end point.
Point endPoint = startPoint + new Size(140, 150);
// Draw a line between the points.
e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint);
// Convert the starting point to a size and compare it to the
// subtractButton size.
Size buttonSize = (Size)startPoint;
if (buttonSize == subtractButton.Size)
// If the sizes are equal, tell the user.
{
e.Graphics.DrawString("The sizes are equal.",
new Font(this.Font, FontStyle.Italic),
Brushes.Indigo, 10.0F, 65.0F);
}
}
Private Sub CreatePointsAndSizes(ByVal e As PaintEventArgs)
' Create the starting point.
Dim startPoint As New Point(subtractButton.Size)
' Use the addition operator to get the end point.
Dim endPoint As Point = Point.op_Addition(startPoint, _
New Size(140, 150))
' Draw a line between the points.
e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint)
' Convert the starting point to a size and compare it to the
' subtractButton size.
Dim buttonSize As Size = Point.op_Explicit(startPoint)
If (Size.op_Equality(buttonSize, subtractButton.Size)) Then
' If the sizes are equal, tell the user.
e.Graphics.DrawString("The sizes are equal.", _
New Font(Me.Font, FontStyle.Italic), _
Brushes.Indigo, 10.0F, 65.0F)
End If
End Sub
注釈
Note
.NET 6 以降のバージョンでは、この種類を含む System.Drawing.Common パッケージは、Windows オペレーティング システムでのみサポートされています。 クロスプラットフォーム アプリでこの種類を使用すると、コンパイル時の警告と実行時の例外が発生します。 詳細については、「System.Drawing.Common が Windows でしかサポートされない」を参照してください。
プロパティ
| 名前 | 説明 |
|---|---|
| ActiveBorder |
作業中のウィンドウの境界線の色である Pen を取得します。 |
| ActiveCaption |
作業中のウィンドウのタイトル バーの背景の色である Pen を取得します。 |
| ActiveCaptionText |
作業中のウィンドウのタイトル バーのテキストの色である Pen を取得します。 |
| AppWorkspace |
アプリケーション ワークスペースの色である Pen を取得します。 |
| ButtonFace |
3-D 要素の顔の色である Pen を取得します。 |
| ButtonHighlight |
3-D 要素の強調表示色である Pen を取得します。 |
| ButtonShadow |
3-D 要素の影の色である Pen を取得します。 |
| Control |
3-D 要素の顔の色である Pen を取得します。 |
| ControlDark |
3-D 要素の影の色である Pen を取得します。 |
| ControlDarkDark |
3-D 要素の濃い影の色である Pen を取得します。 |
| ControlLight |
3-D 要素の明るい色である Pen を取得します。 |
| ControlLightLight |
3-D 要素の強調表示色である Pen を取得します。 |
| ControlText |
3-D 要素内のテキストの色である Pen を取得します。 |
| Desktop |
Windows デスクトップの色である Pen を取得します。 |
| GradientActiveCaption |
アクティブなウィンドウのタイトル バーの色グラデーションで最も明るい色の Pen を取得します。 |
| GradientInactiveCaption |
非アクティブなウィンドウのタイトル バーの色グラデーションの中で最も明るい色である Pen を取得します。 |
| GrayText |
淡色表示されたテキストの色である Pen を取得します。 |
| Highlight |
選択した項目の背景の色である Pen を取得します。 |
| HighlightText |
選択した項目のテキストの色である Pen を取得します。 |
| HotTrack |
ホット 追跡対象の項目を指定するために使用される色である Pen を取得します。 |
| InactiveBorder |
非アクティブなウィンドウの境界線の色である Pen を取得します。 |
| InactiveCaption |
非アクティブなウィンドウのタイトル バーのキャプションの色である Pen を取得します。 |
| InactiveCaptionText |
非アクティブなウィンドウのタイトル バーのテキストの色である Pen を取得します。 |
| Info |
ツールヒントの背景の色である Pen を取得します。 |
| InfoText |
ツールヒントのテキストの色である Pen を取得します。 |
| Menu |
メニューの背景の色である Pen を取得します。 |
| MenuBar |
メニュー バーの背景の色である Pen を取得します。 |
| MenuHighlight |
メニューがフラット メニューとして表示されるときにメニュー項目を強調表示するために使用される色である Pen を取得します。 |
| MenuText |
メニューのテキストの色である Pen を取得します。 |
| ScrollBar |
スクロール バーの背景の色である Pen を取得します。 |
| Window |
ウィンドウのクライアント領域の背景の色である Pen を取得します。 |
| WindowFrame |
ウィンドウ フレームの色である Pen を取得します。 |
| WindowText |
ウィンドウのクライアント領域内のテキストの色である Pen を取得します。 |
メソッド
| 名前 | 説明 |
|---|---|
| Equals(Object) |
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| FromSystemColor(Color) | |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |