- rgb
- The rgb value.
Visual Basic (Declaration) | |
---|---|
Public Shared Function FromRgb( _ ByVal rgb As Integer _ ) As RasterColor |
Visual Basic (Usage) | Copy Code |
---|---|
Dim rgb As Integer Dim value As RasterColor value = RasterColor.FromRgb(rgb) |
C# | |
---|---|
public static RasterColor FromRgb( int rgb ) |
C++/CLI | |
---|---|
public: static RasterColor FromRgb( int rgb ) |
Parameters
- rgb
- The rgb value.
Return Value
The RasterColor structure that this method creates.This example will create an array of RasterColor containing 256 shades of gray.
Visual Basic | Copy Code |
---|---|
Public Sub FromRgbExample() Dim colors As RasterColor() = New RasterColor(RasterColor.MaximumComponent - RasterColor.MinimumComponent) {} Dim i As Integer = RasterColor.MinimumComponent Do While i < RasterColor.MaximumComponent colors(i) = RasterColor.FromRgb(i) i += 1 Loop i = RasterColor.MinimumComponent Do While i < RasterColor.MaximumComponent Debug.Assert(colors(i).ToRgb() = i) i += 1 Loop End Sub |
C# | Copy Code |
---|---|
public void FromRgbExample() { RasterColor[] colors = new RasterColor[RasterColor.MaximumComponent - RasterColor.MinimumComponent + 1]; for(int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++) { colors[i] = RasterColor.FromRgb(i); } for(int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++) { Debug.Assert(colors[i].ToRgb() == i); } } |
SilverlightCSharp | Copy Code |
---|---|
[TestMethod] public void FromRgbExample() { RasterColor[] colors = new RasterColor[RasterColor.MaximumComponent - RasterColor.MinimumComponent + 1]; for(int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++) { colors[i] = RasterColor.FromRgb(i); } for(int i = RasterColor.MinimumComponent; i < RasterColor.MaximumComponent; i++) { Debug.Assert(colors[i].ToRgb() == i); } } |
SilverlightVB | Copy Code |
---|---|
<TestMethod> _ Public Sub FromRgbExample() Dim colors As RasterColor() = New RasterColor(RasterColor.MaximumComponent - RasterColor.MinimumComponent){} Dim i As Integer = RasterColor.MinimumComponent Do While i < RasterColor.MaximumComponent colors(i) = RasterColor.FromRgb(i) i += 1 Loop i = RasterColor.MinimumComponent Do While i < RasterColor.MaximumComponent Debug.Assert(colors(i).ToRgb() = i) i += 1 Loop End Sub |
Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only), Windows Phone 7