ArcObjects Library Reference  

ColorUtilities

About the 3D multipatch examples Sample

[C#]

ColorUtilities.cs

using ESRI.ArcGIS.Display;

namespace MultiPatchExamples
{
    public enum TransparencyType
    {
        Transparent = 0,
        Opaque = 255
    }

    public static class ColorUtilities
    {
        private static TransparencyType _transparency = TransparencyType.Opaque;

        public static IColor GetColor(int red, int green, int blue)
        {
            IRgbColor rgbColor = new RgbColorClass();
            rgbColor.Red = red;
            rgbColor.Green = green;
            rgbColor.Blue = blue;

            IColor color = rgbColor as IColor;
            color.Transparency = (byte)_transparency;

            return color;
        }
    }
}
[Visual Basic .NET]

ColorUtilities.vb

Imports Microsoft.VisualBasic
Imports System
Imports ESRI.ArcGIS.Display


Public Enum TransparencyType
    Transparent = 0
    Opaque = 255
End Enum

Public Class ColorUtilities
    Private Shared _transparency As TransparencyType = TransparencyType.Opaque

    Private Sub New()
    End Sub
    Public Shared Function GetColor(ByVal red As Integer, ByVal green As Integer, ByVal blue As Integer) As IColor
        Dim rgbColor As IRgbColor = New RgbColorClass()
        rgbColor.Red = red
        rgbColor.Green = green
        rgbColor.Blue = blue

        Dim color As IColor = TryCast(rgbColor, IColor)
        color.Transparency = CByte(_transparency)

        Return color
    End Function
End Class