Color.FromArgb Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Erstellt eine Color-Struktur aus den vier 8-Bit-ARGB-Komponentenwerten (Alpha, rot, grün und blau).
Überlädt
FromArgb(Int32, Int32, Int32, Int32) |
Erstellt eine Color-Struktur aus den vier ARGB-Komponentenwerten (Alpha, rot, grün und blau). Obwohl bei dieser Methode die Übergabe eines 32-Bit-Werts für jeden Komponente möglich wäre, ist der Wert für die einzelnen Komponenten auf jeweils 8 Bits beschränkt. |
FromArgb(Int32, Int32, Int32) |
Erstellt eine Color-Struktur aus den angegebenen 8-Bit-Farbwerten (rot, grün und blau). Der Alphawert ist implizit 255 (nicht transparent). Obwohl bei dieser Methode die Übergabe eines 32-Bit-Werts für jeden Farbanteil möglich wäre, ist der Wert für die einzelnen Anteile auf jeweils 8 Bits beschränkt. |
FromArgb(Int32, Color) |
Erstellt eine Color-Struktur aus der angegebenen Color-Struktur, jedoch mit dem neu angegebenen Alphawert. Obwohl bei dieser Methode die Übergabe eines 32-Bit-Werts für den Alphawert möglich wäre, ist der Wert auf 8 Bits beschränkt. |
FromArgb(Int32) |
Erstellt eine Color-Struktur aus einem 32-Bit-ARGB-Wert. |
FromArgb(Int32, Int32, Int32, Int32)
- Quelle:
- Color.cs
- Quelle:
- Color.cs
- Quelle:
- Color.cs
Erstellt eine Color-Struktur aus den vier ARGB-Komponentenwerten (Alpha, rot, grün und blau). Obwohl bei dieser Methode die Übergabe eines 32-Bit-Werts für jeden Komponente möglich wäre, ist der Wert für die einzelnen Komponenten auf jeweils 8 Bits beschränkt.
public:
static System::Drawing::Color FromArgb(int alpha, int red, int green, int blue);
public static System.Drawing.Color FromArgb (int alpha, int red, int green, int blue);
static member FromArgb : int * int * int * int -> System.Drawing.Color
Public Shared Function FromArgb (alpha As Integer, red As Integer, green As Integer, blue As Integer) As Color
Parameter
- alpha
- Int32
Die Alphakomponente. Gültige Werte sind 0 bis 255.
- red
- Int32
Der Rotanteil. Gültige Werte sind 0 bis 255.
- green
- Int32
Der Grünanteil. Gültige Werte sind 0 bis 255.
- blue
- Int32
Der Blauanteil. Gültige Werte sind 0 bis 255.
Gibt zurück
Die Color, die von dieser Methode erstellt wird.
Ausnahmen
alpha
, red
, green
oder blue
ist kleiner als 0 oder größer als 255.
Beispiele
Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse
, was ein Parameter des Paint Ereignishandlers ist. Der Code führt die folgenden Aktionen aus:
Erstellt drei Pinsel mit jeweils einer anderen Farbe. Jede Color Struktur, die zum Erstellen eines Pinsels verwendet wird, wird aus vier Komponentenwerten (Alpha, Rot, Grün, Blau) erstellt.
Verwendet ein imaginäres Dreieck, um drei Kreise zu positionieren.
Zeichnet drei überlappende Kreise, die jeweils auf einem Scheitelpunkt des Dreiecks zentriert sind, wobei für jeden Kreis ein anderer Pinsel verwendet wird.
void FromArgb1( PaintEventArgs^ e )
{
Graphics^ g = e->Graphics;
// Transparent red, green, and blue brushes.
SolidBrush^ trnsRedBrush = gcnew SolidBrush( Color::FromArgb( 120, 255, 0, 0 ) );
SolidBrush^ trnsGreenBrush = gcnew SolidBrush( Color::FromArgb( 120, 0, 255, 0 ) );
SolidBrush^ trnsBlueBrush = gcnew SolidBrush( Color::FromArgb( 120, 0, 0, 255 ) );
// Base and height of the triangle that is used to position the
// circles. Each vertex of the triangle is at the center of one of the
// 3 circles. The base is equal to the diameter of the circles.
float triBase = 100;
float triHeight = (float)Math::Sqrt( 3 * (triBase * triBase) / 4 );
// Coordinates of first circle's bounding rectangle.
float x1 = 40;
float y1 = 40;
// Fill 3 over-lapping circles. Each circle is a different color.
g->FillEllipse( trnsRedBrush, x1, y1, 2 * triHeight, 2 * triHeight );
g->FillEllipse( trnsGreenBrush, x1 + triBase / 2, y1 + triHeight, 2 * triHeight, 2 * triHeight );
g->FillEllipse( trnsBlueBrush, x1 + triBase, y1, 2 * triHeight, 2 * triHeight );
}
public void FromArgb1(PaintEventArgs e)
{
Graphics g = e.Graphics;
// Transparent red, green, and blue brushes.
SolidBrush trnsRedBrush = new SolidBrush(Color.FromArgb(120, 255, 0, 0));
SolidBrush trnsGreenBrush = new SolidBrush(Color.FromArgb(120, 0, 255, 0));
SolidBrush trnsBlueBrush = new SolidBrush(Color.FromArgb(120, 0, 0, 255));
// Base and height of the triangle that is used to position the
// circles. Each vertex of the triangle is at the center of one of the
// 3 circles. The base is equal to the diameter of the circles.
float triBase = 100;
float triHeight = (float)Math.Sqrt(3*(triBase*triBase)/4);
// Coordinates of first circle's bounding rectangle.
float x1 = 40;
float y1 = 40;
// Fill 3 over-lapping circles. Each circle is a different color.
g.FillEllipse(trnsRedBrush, x1, y1, 2*triHeight, 2*triHeight);
g.FillEllipse(trnsGreenBrush, x1 + triBase/2, y1 + triHeight,
2*triHeight, 2*triHeight);
g.FillEllipse(trnsBlueBrush, x1 + triBase, y1, 2*triHeight, 2*triHeight);
}
Public Sub FromArgb1(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
' Transparent red, green, and blue brushes.
Dim trnsRedBrush As New SolidBrush(Color.FromArgb(120, 255, 0, 0))
Dim trnsGreenBrush As New SolidBrush(Color.FromArgb(120, 0, _
255, 0))
Dim trnsBlueBrush As New SolidBrush(Color.FromArgb(120, 0, 0, 255))
' Base and height of the triangle that is used to position the
' circles. Each vertex of the triangle is at the center of one of
' the 3 circles. The base is equal to the diameter of the circle.
Dim triBase As Single = 100
Dim triHeight As Single = CSng(Math.Sqrt((3 * (triBase * _
triBase) / 4)))
' Coordinates of first circle's bounding rectangle.
Dim x1 As Single = 40
Dim y1 As Single = 40
' Fill 3 over-lapping circles. Each circle is a different color.
g.FillEllipse(trnsRedBrush, x1, y1, 2 * triHeight, 2 * triHeight)
g.FillEllipse(trnsGreenBrush, x1 + triBase / 2, y1 + triHeight, _
2 * triHeight, 2 * triHeight)
g.FillEllipse(trnsBlueBrush, x1 + triBase, y1, 2 * triHeight, _
2 * triHeight)
End Sub
Hinweise
Um eine undurchsichtige Farbe zu erstellen, legen Sie auf 255 fest alpha
. Um eine semitransparente Farbe zu erstellen, legen Sie auf einen beliebigen Wert von 1 bis 254 fest alpha
.
Gilt für:
FromArgb(Int32, Int32, Int32)
- Quelle:
- Color.cs
- Quelle:
- Color.cs
- Quelle:
- Color.cs
Erstellt eine Color-Struktur aus den angegebenen 8-Bit-Farbwerten (rot, grün und blau). Der Alphawert ist implizit 255 (nicht transparent). Obwohl bei dieser Methode die Übergabe eines 32-Bit-Werts für jeden Farbanteil möglich wäre, ist der Wert für die einzelnen Anteile auf jeweils 8 Bits beschränkt.
public:
static System::Drawing::Color FromArgb(int red, int green, int blue);
public static System.Drawing.Color FromArgb (int red, int green, int blue);
static member FromArgb : int * int * int -> System.Drawing.Color
Public Shared Function FromArgb (red As Integer, green As Integer, blue As Integer) As Color
Parameter
Gibt zurück
Die Color, die von dieser Methode erstellt wird.
Ausnahmen
red
, green
oder blue
ist kleiner als 0 oder größer als 255.
Beispiele
Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse
, was ein Parameter des Paint Ereignishandlers ist. Der Code führt die folgenden Aktionen aus:
Erstellt Color Strukturen aus den drei Farbkomponentenwerten (Rot, Grün, Blau). Es werden drei Color Strukturen erstellt, eine für jede Primärfarbe.
Durchläuft einen Bereich von Alphawerten, wobei der Alphawert einer Farbe geändert wird.
Legt während jeder Iteration die Farbe eines Pinsels auf die geänderte Farbe fest und zeichnet ein Rechteck, um die Farbe anzuzeigen.
Wiederholt die Schritte 2 und 3 für jede Primärfarbe.
Der Alphawert ist nie vollständig undurchsichtig, und die Rechtecke überlappen sich, sodass Sie Farbkombinationseffekte erhalten.
void FromArgb2( PaintEventArgs^ e )
{
Graphics^ g = e->Graphics;
// Opaque colors (alpha value defaults to 255 -- max value).
Color red = Color::FromArgb( 255, 0, 0 );
Color green = Color::FromArgb( 0, 255, 0 );
Color blue = Color::FromArgb( 0, 0, 255 );
// Solid brush initialized to red.
SolidBrush^ myBrush = gcnew SolidBrush( red );
int alpha;
// x coordinate of first red rectangle
int x = 50;
// y coordinate of first red rectangle
int y = 50;
// Fill rectangles with red, varying the alpha value from 25 to 250.
for ( alpha = 25; alpha <= 250; alpha += 25 )
{
myBrush->Color = Color::FromArgb( alpha, red );
g->FillRectangle( myBrush, x, y, 50, 100 );
g->FillRectangle( myBrush, x, y + 250, 50, 50 );
x += 50;
}
x = 50;
// y coordinate of first green rectangle.
y += 50;
// Fill rectangles with green, varying the alpha value from 25 to 250.
for ( alpha = 25; alpha <= 250; alpha += 25 )
{
myBrush->Color = Color::FromArgb( alpha, green );
g->FillRectangle( myBrush, x, y, 50, 150 );
x += 50;
}
x = 50;
// y coordinate of first blue rectangle.
y += 100;
// Fill rectangles with blue, varying the alpha value from 25 to 250.
for ( alpha = 25; alpha <= 250; alpha += 25 )
{
myBrush->Color = Color::FromArgb( alpha, blue );
g->FillRectangle( myBrush, x, y, 50, 150 );
x += 50;
}
}
public void FromArgb2(PaintEventArgs e)
{
Graphics g = e.Graphics;
// Opaque colors (alpha value defaults to 255 -- max value).
Color red = Color.FromArgb(255, 0, 0);
Color green = Color.FromArgb(0, 255, 0);
Color blue = Color.FromArgb(0, 0, 255);
// Solid brush initialized to red.
SolidBrush myBrush = new SolidBrush(red);
int alpha;
// x coordinate of first red rectangle
int x = 50;
// y coordinate of first red rectangle
int y = 50;
// Fill rectangles with red, varying the alpha value from 25 to 250.
for (alpha = 25; alpha <= 250; alpha += 25)
{
myBrush.Color = Color.FromArgb(alpha, red);
g.FillRectangle(myBrush, x, y, 50, 100);
g.FillRectangle(myBrush, x, y + 250, 50, 50);
x += 50;
}
// x coordinate of first green rectangle.
x = 50;
// y coordinate of first green rectangle.
y += 50;
// Fill rectangles with green, varying the alpha value from 25 to 250.
for (alpha = 25; alpha <= 250; alpha += 25)
{
myBrush.Color = Color.FromArgb(alpha, green);
g.FillRectangle(myBrush, x, y, 50, 150);
x += 50;
}
// x coordinate of first blue rectangle.
x = 50;
// y coordinate of first blue rectangle.
y += 100;
// Fill rectangles with blue, varying the alpha value from 25 to 250.
for (alpha = 25; alpha <= 250; alpha += 25)
{
myBrush.Color = Color.FromArgb(alpha, blue);
g.FillRectangle(myBrush, x, y, 50, 150);
x += 50;
}
}
Public Sub FromArgb2(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
' Opaque colors (alpha value defaults to 255 -- max value).
Dim red As Color = Color.FromArgb(255, 0, 0)
Dim green As Color = Color.FromArgb(0, 255, 0)
Dim blue As Color = Color.FromArgb(0, 0, 255)
' Solid brush initialized to red.
Dim myBrush As New SolidBrush(red)
Dim alpha As Integer
' x coordinate of first red rectangle.
Dim x As Integer = 50
' y coordinate of first red rectangle.
Dim y As Integer = 50
' Fill rectangles with red, varying the alpha value from 25 to 250.
For alpha = 25 To 250 Step 25
myBrush.Color = Color.FromArgb(alpha, red)
g.FillRectangle(myBrush, x, y, 50, 100)
g.FillRectangle(myBrush, x, y + 250, 50, 50)
x += 50
Next alpha
' x coordinate of first green rectangle.
x = 50
' y coordinate of first green rectangle.
y += 50
' Fill rectangles with green, varying alpha value from 25 to 250.
For alpha = 25 To 250 Step 25
myBrush.Color = Color.FromArgb(alpha, green)
g.FillRectangle(myBrush, x, y, 50, 150)
x += 50
Next alpha
' x coordinate of first blue rectangle.
x = 50
' y coordinate of first blue rectangle.
y += 100
' Fill rectangles with blue, varying alpha value from 25 to 250.
For alpha = 25 To 250 Step 25
myBrush.Color = Color.FromArgb(alpha, blue)
g.FillRectangle(myBrush, x, y, 50, 150)
x += 50
Next alpha
End Sub
Gilt für:
FromArgb(Int32, Color)
- Quelle:
- Color.cs
- Quelle:
- Color.cs
- Quelle:
- Color.cs
public:
static System::Drawing::Color FromArgb(int alpha, System::Drawing::Color baseColor);
public static System.Drawing.Color FromArgb (int alpha, System.Drawing.Color baseColor);
static member FromArgb : int * System.Drawing.Color -> System.Drawing.Color
Public Shared Function FromArgb (alpha As Integer, baseColor As Color) As Color
Parameter
Gibt zurück
Die Color, die von dieser Methode erstellt wird.
Ausnahmen
alpha
ist kleiner als 0 (null) oder größer als 255.
Beispiele
Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse
, was ein Parameter des Paint Ereignishandlers ist. Der Code führt die folgenden Aktionen aus:
Erstellt Color Strukturen aus den drei Farbkomponentenwerten (Rot, Grün, Blau). Es werden drei Color Strukturen erstellt, eine für jede Primärfarbe.
Durchläuft einen Bereich von Alphawerten, wobei der Alphawert einer Farbe geändert wird.
Legt während jeder Iteration die Farbe eines Pinsels auf die geänderte Farbe fest und zeichnet ein Rechteck, um die Farbe anzuzeigen.
Wiederholt die Schritte 2 und 3 für jede Primärfarbe.
Der Alphawert ist nie vollständig undurchsichtig, und die Rechtecke überlappen sich, sodass Sie Farbkombinationseffekte erhalten.
void FromArgb3( PaintEventArgs^ e )
{
Graphics^ g = e->Graphics;
// Opaque colors (alpha value defaults to 255 -- max value).
Color red = Color::FromArgb( 255, 0, 0 );
Color green = Color::FromArgb( 0, 255, 0 );
Color blue = Color::FromArgb( 0, 0, 255 );
// Solid brush initialized to red.
SolidBrush^ myBrush = gcnew SolidBrush( red );
int alpha;
// x coordinate of first red rectangle
int x = 50;
// y coordinate of first red rectangle
int y = 50;
// Fill rectangles with red, varying the alpha value from 25 to 250.
for ( alpha = 25; alpha <= 250; alpha += 25 )
{
myBrush->Color = Color::FromArgb( alpha, red );
g->FillRectangle( myBrush, x, y, 50, 100 );
g->FillRectangle( myBrush, x, y + 250, 50, 50 );
x += 50;
}
x = 50;
// y coordinate of first green rectangle
y += 50;
// Fill rectangles with green, varying the alpha value from 25 to 250.
for ( alpha = 25; alpha <= 250; alpha += 25 )
{
myBrush->Color = Color::FromArgb( alpha, green );
g->FillRectangle( myBrush, x, y, 50, 150 );
x += 50;
}
x = 50;
// y coordinate of first blue rectangle
y += 100;
// Fill rectangles with blue, varying the alpha value from 25 to 250.
for ( alpha = 25; alpha <= 250; alpha += 25 )
{
myBrush->Color = Color::FromArgb( alpha, blue );
g->FillRectangle( myBrush, x, y, 50, 150 );
x += 50;
}
}
public void FromArgb3(PaintEventArgs e)
{
Graphics g = e.Graphics;
// Opaque colors (alpha value defaults to 255 -- max value).
Color red = Color.FromArgb(255, 0, 0);
Color green = Color.FromArgb(0, 255, 0);
Color blue = Color.FromArgb(0, 0, 255);
// Solid brush initialized to red.
SolidBrush myBrush = new SolidBrush(red);
int alpha;
// x coordinate of first red rectangle
int x = 50;
// y coordinate of first red rectangle
int y = 50;
// Fill rectangles with red, varying the alpha value from 25 to 250.
for (alpha = 25; alpha <= 250; alpha += 25)
{
myBrush.Color = Color.FromArgb(alpha, red);
g.FillRectangle(myBrush, x, y, 50, 100);
g.FillRectangle(myBrush, x, y + 250, 50, 50);
x += 50;
}
// x coordinate of first green rectangle
x = 50;
// y coordinate of first green rectangle
y += 50;
// Fill rectangles with green, varying the alpha value from 25 to 250.
for (alpha = 25; alpha <= 250; alpha += 25)
{
myBrush.Color = Color.FromArgb(alpha, green);
g.FillRectangle(myBrush, x, y, 50, 150);
x += 50;
}
// x coordinate of first blue rectangle.
x = 50;
// y coordinate of first blue rectangle
y += 100;
// Fill rectangles with blue, varying the alpha value from 25 to 250.
for (alpha = 25; alpha <= 250; alpha += 25)
{
myBrush.Color = Color.FromArgb(alpha, blue);
g.FillRectangle(myBrush, x, y, 50, 150);
x += 50;
}
}
Public Sub FromArgb3(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
' Opaque colors (alpha value defaults to 255 -- max value).
Dim red As Color = Color.FromArgb(255, 0, 0)
Dim green As Color = Color.FromArgb(0, 255, 0)
Dim blue As Color = Color.FromArgb(0, 0, 255)
' Solid brush initialized to red.
Dim myBrush As New SolidBrush(red)
Dim alpha As Integer
' x coordinate of first red rectangle.
Dim x As Integer = 50
' y coordinate of first red rectangle.
Dim y As Integer = 50
' Fill rectangles with red, varying the alpha value from 25 to 250.
For alpha = 25 To 250 Step 25
myBrush.Color = Color.FromArgb(alpha, red)
g.FillRectangle(myBrush, x, y, 50, 100)
g.FillRectangle(myBrush, x, y + 250, 50, 50)
x += 50
Next alpha
' x coordinate of first green rectangle.
x = 50
' y coordinate of first green rectangle.
y += 50
' Fill rectangles with green, varying alpha value from 25 to 250.
For alpha = 25 To 250 Step 25
myBrush.Color = Color.FromArgb(alpha, green)
g.FillRectangle(myBrush, x, y, 50, 150)
x += 50
Next alpha
' x coordinate of first blue rectangle.
x = 50
' y coordinate of first blue rectangle.
y += 100
' Fill rectangles with blue, varying alpha value from 25 to 250.
For alpha = 25 To 250 Step 25
myBrush.Color = Color.FromArgb(alpha, blue)
g.FillRectangle(myBrush, x, y, 50, 150)
x += 50
Next alpha
End Sub
Hinweise
Um eine undurchsichtige Farbe zu erstellen, legen Sie auf 255 fest alpha
. Um eine semitransparente Farbe zu erstellen, legen Sie auf einen beliebigen Wert von 1 bis 254 fest alpha
.
Gilt für:
FromArgb(Int32)
- Quelle:
- Color.cs
- Quelle:
- Color.cs
- Quelle:
- Color.cs
Erstellt eine Color-Struktur aus einem 32-Bit-ARGB-Wert.
public:
static System::Drawing::Color FromArgb(int argb);
public static System.Drawing.Color FromArgb (int argb);
static member FromArgb : int -> System.Drawing.Color
Public Shared Function FromArgb (argb As Integer) As Color
Parameter
- argb
- Int32
Ein Wert, der den 32-Bit-ARGB-Wert angibt.
Gibt zurück
Die von dieser Methode erstellte Color-Struktur.
Beispiele
Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse
, was ein Parameter des Paint Ereignishandlers ist. Der Code führt die folgenden Aktionen aus:
Erstellt drei Pinsel mit jeweils einer anderen Farbe. Jede Color Struktur, die zum Erstellen eines Pinsels verwendet wird, wird aus einem 32-Bit-ARGB-Wert erstellt.
Verwendet ein imaginäres Dreieck, um drei Kreise zu positionieren.
Zeichnet drei überlappende Kreise, die jeweils auf einem Scheitelpunkt des Dreiecks zentriert sind, wobei für jeden Kreis ein anderer Pinsel verwendet wird.
void FromArgb4( PaintEventArgs^ e )
{
Graphics^ g = e->Graphics;
// Transparent red, green, and blue brushes.
SolidBrush^ trnsRedBrush = gcnew SolidBrush( Color::FromArgb( 0x78FF0000 ) );
SolidBrush^ trnsGreenBrush = gcnew SolidBrush( Color::FromArgb( 0x7800FF00 ) );
SolidBrush^ trnsBlueBrush = gcnew SolidBrush( Color::FromArgb( 0x780000FF ) );
// Base and height of the triangle that is used to position the
// circles. Each vertex of the triangle is at the center of one of the
// 3 circles. The base is equal to the diameter of the circles.
float triBase = 100;
float triHeight = (float)Math::Sqrt( 3 * (triBase * triBase) / 4 );
// coordinates of first circle's bounding rectangle.
float x1 = 40;
float y1 = 40;
// Fill 3 over-lapping circles. Each circle is a different color.
g->FillEllipse( trnsRedBrush, x1, y1, 2 * triHeight, 2 * triHeight );
g->FillEllipse( trnsGreenBrush, x1 + triBase / 2, y1 + triHeight, 2 * triHeight, 2 * triHeight );
g->FillEllipse( trnsBlueBrush, x1 + triBase, y1, 2 * triHeight, 2 * triHeight );
}
public void FromArgb4(PaintEventArgs e)
{
Graphics g = e.Graphics;
// Transparent red, green, and blue brushes.
SolidBrush trnsRedBrush = new SolidBrush(Color.FromArgb(0x78FF0000));
SolidBrush trnsGreenBrush = new SolidBrush(Color.FromArgb(0x7800FF00));
SolidBrush trnsBlueBrush = new SolidBrush(Color.FromArgb(0x780000FF));
// Base and height of the triangle that is used to position the
// circles. Each vertex of the triangle is at the center of one of the
// 3 circles. The base is equal to the diameter of the circles.
float triBase = 100;
float triHeight = (float)Math.Sqrt(3*(triBase*triBase)/4);
// coordinates of first circle's bounding rectangle.
float x1 = 40;
float y1 = 40;
// Fill 3 over-lapping circles. Each circle is a different color.
g.FillEllipse(trnsRedBrush, x1, y1, 2*triHeight, 2*triHeight);
g.FillEllipse(trnsGreenBrush, x1 + triBase/2, y1 + triHeight,
2*triHeight, 2*triHeight);
g.FillEllipse(trnsBlueBrush, x1 + triBase, y1, 2*triHeight, 2*triHeight);
}
Public Sub FromArgb4(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
' Transparent red, green, and blue brushes.
Dim trnsRedBrush As New SolidBrush(Color.FromArgb(&H78FF0000))
Dim trnsGreenBrush As New SolidBrush(Color.FromArgb(&H7800FF00))
Dim trnsBlueBrush As New SolidBrush(Color.FromArgb(&H780000FF))
' Base and height of the triangle that is used to position the
' circles. Each vertex of the triangle is at the center of one of
' the 3 circles. The base is equal to the diameter of the circle.
Dim triBase As Single = 100
Dim triHeight As Single = CSng(Math.Sqrt((3 * (triBase * _
triBase) / 4)))
' Coordinates of first circle
's bounding rectangle.
Dim x1 As Single = 40
Dim y1 As Single = 40
' Fill 3 over-lapping circles. Each circle is a different color.
g.FillEllipse(trnsRedBrush, x1, y1, 2 * triHeight, 2 * triHeight)
g.FillEllipse(trnsGreenBrush, x1 + triBase / 2, y1 + triHeight, _
2 * triHeight, 2 * triHeight)
g.FillEllipse(trnsBlueBrush, x1 + triBase, y1, 2 * triHeight, _
2 * triHeight)
End Sub
Hinweise
Die Bytereihenfolge des 32-Bit-ARGB-Werts ist AARRGGBB. Das bedeutendste Byte (MSB), dargestellt durch AA, ist der Wert der Alphakomponente. Das zweite, dritte und vierte Byte, dargestellt durch RR, GG bzw. BB, sind die Farbkomponenten Rot, Grün bzw. Blau.
Gilt für:
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Issues stufenweise als Feedbackmechanismus für Inhalte abbauen und durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unterFeedback senden und anzeigen für