LEADTOOLS (Leadtools assembly)
LEAD Technologies, Inc

RasterColorTypeConverter Class

Example 





Members 
Converts RasterColor objects from one data type to another. Access this class through the System.ComponentModel.TypeConverter .NET support Silverlight support
Object Model
RasterColorTypeConverter Class
Syntax
public class RasterColorTypeConverter : System.ComponentModel.TypeConverter 
'Declaration
 
Public Class RasterColorTypeConverter 
   Inherits System.ComponentModel.TypeConverter
'Usage
 
Dim instance As RasterColorTypeConverter
public sealed class RasterColorTypeConverter : System.ComponentModel.TypeConverter 
function Leadtools.RasterColorTypeConverter()
public ref class RasterColorTypeConverter : public System.ComponentModel.TypeConverter 
Remarks

To convert a RasterColor to a string value, use the RasterColor.ToString method.

You can use the members of this class to convert a string to a RasterColor value. You can also use the helper static (Shared) RasterColorTypeConverter.ConvertFromString method directly without creating a System.ComponentModel.TypeConverter instance.

Currently, this class supports converting a RasterColor to and from a string type only. The string can be in an HTML compatible format.

Example
 
Public Sub RasterColorTypeConverterExample()
   Dim clr As RasterColor

   ' Convert different type of color string representation to RasterColor objects
   clr = RasterColorTypeConverter.ConvertFromString("Red")
   Console.WriteLine("Red: " + clr.ToString())
   clr = RasterColorTypeConverter.ConvertFromString("BLUE")
   Console.WriteLine("BLUE: " + clr.ToString())
   clr = RasterColorTypeConverter.ConvertFromString("#F3AABBCC")
   Console.WriteLine("#F3AABBCC: " + clr.ToString())

   ' Convert this last color back to string
   Dim temp As String = clr.ToString()
   ' Convert it back to color
   clr = RasterColorTypeConverter.ConvertFromString(temp)
   Console.WriteLine(temp + ": " + clr.ToString())
End Sub
public void RasterColorTypeConverterExample()
{
   RasterColor clr;

   // Convert different type of color string representation to RasterColor objects
   clr = RasterColorTypeConverter.ConvertFromString("Red");
   Console.WriteLine("Red: " + clr.ToString());
   clr = RasterColorTypeConverter.ConvertFromString("BLUE");
   Console.WriteLine("BLUE: " + clr.ToString());
   clr = RasterColorTypeConverter.ConvertFromString("#F3AABBCC");
   Console.WriteLine("#F3AABBCC: " + clr.ToString());

   // Convert this last color back to string
   string temp = clr.ToString();
   // Convert it back to color
   clr = RasterColorTypeConverter.ConvertFromString(temp);
   Console.WriteLine(temp + ": " + clr.ToString());
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RasterColorTypeConverter Members
Leadtools Namespace

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.