Color 構造体
定義
ARGB (アルファ、赤、緑、青) 色を表します。Represents an ARGB (alpha, red, green, blue) color.
public value class Color : IEquatable<System::Drawing::Color>
public value class Color
[System.ComponentModel.TypeConverter("System.Drawing.ColorConverter, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public struct Color : IEquatable<System.Drawing.Color>
public struct Color : IEquatable<System.Drawing.Color>
[System.ComponentModel.TypeConverter(typeof(System.Drawing.ColorConverter))]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public struct Color
[System.ComponentModel.TypeConverter(typeof(System.Drawing.ColorConverter))]
[System.Serializable]
public struct Color
public struct Color
[<System.ComponentModel.TypeConverter("System.Drawing.ColorConverter, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
type Color = struct
type Color = struct
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.ColorConverter))>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type Color = struct
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.ColorConverter))>]
[<System.Serializable>]
type Color = struct
Public Structure Color
Implements IEquatable(Of Color)
Public Structure Color
- 継承
- 属性
- 実装
例
次のコード例は、の、、、およびの各プロパティと、メンバーを示して A R G B Color Implicit います。The following code example demonstrates the A, R, G, and B properties of a Color, and the Implicit member.
この例は、Windows フォームと共に使用するように設計されています。This example is designed to be used with a Windows Form. フォームにコードを貼り付け、 ShowPropertiesOfSlateBlue
Paint という形式でフォームのイベント処理メソッドからメソッドを呼び出し e
PaintEventArgs ます。Paste the code into the form and call the ShowPropertiesOfSlateBlue
method from the form's Paint event-handling method, passing e
as PaintEventArgs.
void ShowPropertiesOfSlateBlue( PaintEventArgs^ e )
{
Color slateBlue = Color::FromName( "SlateBlue" );
Byte g = slateBlue.G;
Byte b = slateBlue.B;
Byte r = slateBlue.R;
Byte a = slateBlue.A;
array<Object^>^temp0 = {a,r,g,b};
String^ text = String::Format( "Slate Blue has these ARGB values: Alpha:{0}, "
"red:{1}, green: {2}, blue {3}", temp0 );
e->Graphics->DrawString( text, gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), gcnew SolidBrush( slateBlue ), RectangleF(PointF(0.0F,0.0F),this->Size) );
}
private void ShowPropertiesOfSlateBlue(PaintEventArgs e)
{
Color slateBlue = Color.FromName("SlateBlue");
byte g = slateBlue.G;
byte b = slateBlue.B;
byte r = slateBlue.R;
byte a = slateBlue.A;
string text = String.Format("Slate Blue has these ARGB values: Alpha:{0}, " +
"red:{1}, green: {2}, blue {3}", new object[]{a, r, g, b});
e.Graphics.DrawString(text,
new Font(this.Font, FontStyle.Italic),
new SolidBrush(slateBlue),
new RectangleF(new PointF(0.0F, 0.0F), this.Size));
}
Private Sub ShowPropertiesOfSlateBlue(ByVal e As PaintEventArgs)
Dim slateBlue As Color = Color.FromName("SlateBlue")
Dim g As Byte = slateBlue.G
Dim b As Byte = slateBlue.B
Dim r As Byte = slateBlue.R
Dim a As Byte = slateBlue.A
Dim text As String = _
String.Format("Slate Blue has these ARGB values: Alpha:{0}, " _
& "red:{1}, green: {2}, blue {3}", New Object() {a, r, g, b})
e.Graphics.DrawString(text, New Font(Me.Font, FontStyle.Italic), _
New SolidBrush(slateBlue), _
New RectangleF(New PointF(0.0F, 0.0F), _
Size.op_Implicit(Me.Size)))
End Sub
注釈
名前付きの色は、構造体のプロパティを使用して表され Color ます。Named colors are represented by using the properties of the Color structure. これらの色の詳細については、「 名前別の色」を参照してください。For more information about these colors, see Colors by Name.
各ピクセルの色は、32ビットの数値として表されます。アルファ、赤、緑、および青 (ARGB) はそれぞれ8ビットです。The color of each pixel is represented as a 32-bit number: 8 bits each for alpha, red, green, and blue (ARGB). 4つの各コンポーネントは、0 ~ 255 の数値です。0は濃度を表し、255は完全な輝度を表します。Each of the four components is a number from 0 through 255, with 0 representing no intensity and 255 representing full intensity. アルファコンポーネントは、色の透明度を指定します。0は完全に透明で、255は完全に不透明です。The alpha component specifies the transparency of the color: 0 is fully transparent, and 255 is fully opaque. 色のアルファ、赤、緑、または青のコンポーネントを決定するには A 、 R それぞれ、、 G 、または B プロパティを使用します。To determine the alpha, red, green, or blue component of a color, use the A, R, G, or B property, respectively. メソッドのいずれかを使用して、カスタム色を作成でき FromArgb ます。You can create a custom color by using one of the FromArgb methods.
フィールド
Empty |
|
プロパティ
A |
この Color 構造体のアルファ要素値を取得します。Gets the alpha component value of this Color structure. |
AliceBlue |
ARGB 値が |
AntiqueWhite |
ARGB 値が |
Aqua |
ARGB 値が |
Aquamarine |
ARGB 値が |
Azure |
ARGB 値が |
B |
この Color 構造体の青要素値を取得します。Gets the blue component value of this Color structure. |
Beige |
ARGB 値が |
Bisque |
ARGB 値が |
Black |
ARGB 値が |
BlanchedAlmond |
ARGB 値が |
Blue |
ARGB 値が |
BlueViolet |
ARGB 値が |
Brown |
ARGB 値が |
BurlyWood |
ARGB 値が |
CadetBlue |
ARGB 値が |
Chartreuse |
ARGB 値が |
Chocolate |
ARGB 値が |
Coral |
ARGB 値が |
CornflowerBlue |
ARGB 値が |
Cornsilk |
ARGB 値が |
Crimson |
ARGB 値が |
Cyan |
ARGB 値が |
DarkBlue |
ARGB 値が |
DarkCyan |
ARGB 値が |
DarkGoldenrod |
ARGB 値が |
DarkGray |
ARGB 値が |
DarkGreen |
ARGB 値が |
DarkKhaki |
ARGB 値が |
DarkMagenta |
ARGB 値が |
DarkOliveGreen |
ARGB 値が |
DarkOrange |
ARGB 値が |
DarkOrchid |
ARGB 値が |
DarkRed |
ARGB 値が |
DarkSalmon |
ARGB 値が |
DarkSeaGreen |
ARGB 値が |
DarkSlateBlue |
ARGB 値が |
DarkSlateGray |
ARGB 値が |
DarkTurquoise |
ARGB 値が |
DarkViolet |
ARGB 値が |
DeepPink |
ARGB 値が |
DeepSkyBlue |
ARGB 値が |
DimGray |
ARGB 値が |
DodgerBlue |
ARGB 値が |
Firebrick |
ARGB 値が |
FloralWhite |
ARGB 値が |
ForestGreen |
ARGB 値が |
Fuchsia |
ARGB 値が |
G |
この Color 構造体の緑要素値を取得します。Gets the green component value of this Color structure. |
Gainsboro |
ARGB 値が |
GhostWhite |
ARGB 値が |
Gold |
ARGB 値が |
Goldenrod |
ARGB 値が |
Gray |
ARGB 値が |
Green |
ARGB 値が |
GreenYellow |
ARGB 値が |
Honeydew |
ARGB 値が |
HotPink |
ARGB 値が |
IndianRed |
ARGB 値が |
Indigo |
ARGB 値が |
IsEmpty |
この Color 構造体を初期化するかどうかを指定します。Specifies whether this Color structure is uninitialized. |
IsKnownColor |
この Color 構造体が定義済みの色かどうかを示す値を取得します。Gets a value indicating whether this Color structure is a predefined color. 定義済みの色は KnownColor 列挙体の要素によって表されます。Predefined colors are represented by the elements of the KnownColor enumeration. |
IsNamedColor |
この Color 構造体が名前付きの色であるかまたは KnownColor 列挙体のメンバーであるかを示す値を取得します。Gets a value indicating whether this Color structure is a named color or a member of the KnownColor enumeration. |
IsSystemColor |
この Color 構造体がシステム カラーかどうかを示す値を取得します。Gets a value indicating whether this Color structure is a system color. システム カラーとは、Windows の表示要素に使用される色です。A system color is a color that is used in a Windows display element. システム カラーは KnownColor 列挙体の要素によって表されます。System colors are represented by elements of the KnownColor enumeration. |
Ivory |
ARGB 値が |
Khaki |
ARGB 値が |
Lavender |
ARGB 値が |
LavenderBlush |
ARGB 値が |
LawnGreen |
ARGB 値が |
LemonChiffon |
ARGB 値が |
LightBlue |
ARGB 値が |
LightCoral |
ARGB 値が |
LightCyan |
ARGB 値が |
LightGoldenrodYellow |
ARGB 値が |
LightGray |
ARGB 値が |
LightGreen |
ARGB 値が |
LightPink |
ARGB 値が |
LightSalmon |
ARGB 値が |
LightSeaGreen |
ARGB 値が |
LightSkyBlue |
ARGB 値が |
LightSlateGray |
ARGB 値が |
LightSteelBlue |
ARGB 値が |
LightYellow |
ARGB 値が |
Lime |
ARGB 値が |
LimeGreen |
ARGB 値が |
Linen |
ARGB 値が |
Magenta |
ARGB 値が |
Maroon |
ARGB 値が |
MediumAquamarine |
ARGB 値が |
MediumBlue |
ARGB 値が |
MediumOrchid |
ARGB 値が |
MediumPurple |
ARGB 値が |
MediumSeaGreen |
ARGB 値が |
MediumSlateBlue |
ARGB 値が |
MediumSpringGreen |
ARGB 値が |
MediumTurquoise |
ARGB 値が |
MediumVioletRed |
ARGB 値が |
MidnightBlue |
ARGB 値が |
MintCream |
ARGB 値が |
MistyRose |
ARGB 値が |
Moccasin |
ARGB 値が |
Name | |
NavajoWhite |
ARGB 値が |
Navy |
ARGB 値が |
OldLace |
ARGB 値が |
Olive |
ARGB 値が |
OliveDrab |
ARGB 値が |
Orange |
ARGB 値が |
OrangeRed |
ARGB 値が |
Orchid |
ARGB 値が |
PaleGoldenrod |
ARGB 値が |
PaleGreen |
ARGB 値が |
PaleTurquoise |
ARGB 値が |
PaleVioletRed |
ARGB 値が |
PapayaWhip |
ARGB 値が |
PeachPuff |
ARGB 値が |
Peru |
ARGB 値が |
Pink |
ARGB 値が |
Plum |
ARGB 値が |
PowderBlue |
ARGB 値が |
Purple |
ARGB 値が |
R |
この Color 構造体の赤要素値を取得します。Gets the red component value of this Color structure. |
Red |
ARGB 値が |
RosyBrown |
ARGB 値が |
RoyalBlue |
ARGB 値が |
SaddleBrown |
ARGB 値が |
Salmon |
ARGB 値が |
SandyBrown |
ARGB 値が |
SeaGreen |
ARGB 値が |
SeaShell |
ARGB 値が |
Sienna |
ARGB 値が |
Silver |
ARGB 値が |
SkyBlue |
ARGB 値が |
SlateBlue |
ARGB 値が |
SlateGray |
ARGB 値が |
Snow |
ARGB 値が |
SpringGreen |
ARGB 値が |
SteelBlue |
ARGB 値が |
Tan |
ARGB 値が |
Teal |
ARGB 値が |
Thistle |
ARGB 値が |
Tomato |
ARGB 値が |
Transparent |
システム定義色を取得します。Gets a system-defined color. |
Turquoise |
ARGB 値が |
Violet |
ARGB 値が |
Wheat |
ARGB 値が |
White |
ARGB 値が |
WhiteSmoke |
ARGB 値が |
Yellow |
ARGB 値が |
YellowGreen |
ARGB 値が |
メソッド
Equals(Color) |
現在のオブジェクトが、同じ型の別のオブジェクトと等しいかどうかを示します。Indicates whether the current object is equal to another object of the same type. |
Equals(Object) |
指定されたオブジェクトが Color 構造体かどうか、また、この Color 構造体と等価かどうかをテストします。Tests whether the specified object is a Color structure and is equivalent to this Color structure. |
FromArgb(Int32) |
32 ビットの ARGB 値から Color 構造体を作成します。Creates a Color structure from a 32-bit ARGB value. |
FromArgb(Int32, Color) |
指定した Color 構造体から Color 構造体を作成します (ただし、アルファ値は新しく指定したものを使用)。Creates a Color structure from the specified Color structure, but with the new specified alpha value. このメソッドではアルファ値として 32 ビット値を渡すことができますが、有効な値は 8 ビットに制限されています。Although this method allows a 32-bit value to be passed for the alpha value, the value is limited to 8 bits. |
FromArgb(Int32, Int32, Int32) |
指定した 8 ビット カラー値 (赤、緑、青) から Color 構造体を作成します。Creates a Color structure from the specified 8-bit color values (red, green, and blue). アルファ値は暗黙的に 255 (完全に不透明) になります。The alpha value is implicitly 255 (fully opaque). このメソッドでは各カラー コンポーネントとして 32 ビット値を渡すことができますが、各コンポーネントの値は 8 ビットに制限されています。Although this method allows a 32-bit value to be passed for each color component, the value of each component is limited to 8 bits. |
FromArgb(Int32, Int32, Int32, Int32) |
4 つの ARGB 要素 (アルファ、赤、緑、青) 値から Color 構造体を作成します。Creates a Color structure from the four ARGB component (alpha, red, green, and blue) values. このメソッドでは各要素として 32 ビット値を渡すことができますが、各要素の値は 8 ビットに制限されています。Although this method allows a 32-bit value to be passed for each component, the value of each component is limited to 8 bits. |
FromKnownColor(KnownColor) |
指定した定義済みの色から Color 構造体を作成します。Creates a Color structure from the specified predefined color. |
FromName(String) |
定義済みの色の指定した名前から Color 構造体を作成します。Creates a Color structure from the specified name of a predefined color. |
GetBrightness() |
この Color 構造体の、HSL (色相値-彩度値-輝度値) の輝度値を取得します。Gets the hue-saturation-lightness (HSL) lightness value for this Color structure. |
GetHashCode() |
この Color 構造体のハッシュ コードを返します。Returns a hash code for this Color structure. |
GetHue() |
この Color 構造体の HSL (色相値-彩度値-輝度値) の色相値を取得します。Gets the hue-saturation-lightness (HSL) hue value, in degrees, for this Color structure. |
GetSaturation() |
この Color 構造体の HSL (色相値-彩度値-輝度値) の彩度値を取得します。Gets the hue-saturation-lightness (HSL) saturation value for this Color structure. |
ToArgb() |
この Color 構造体の 32 ビットの ARGB 値を取得します。Gets the 32-bit ARGB value of this Color structure. |
ToKnownColor() |
この Color 構造体の KnownColor 値を取得します。Gets the KnownColor value of this Color structure. |
ToString() |
この Color 構造体をユーザーが判読できる文字列に変換します。Converts this Color structure to a human-readable string. |
演算子
Equality(Color, Color) |
指定した 2 つの Color 構造体が等しいかどうかをテストします。Tests whether two specified Color structures are equivalent. |
Inequality(Color, Color) |
指定した 2 つの Color 構造体が異なるかどうかをテストします。Tests whether two specified Color structures are different. |