←Select platform

RasterColorTypeConverter Class

Summary
Converts RasterColor objects from one data type to another. Access this class through the TypeConverter.
Syntax
C#
C++/CLI
Python
public class RasterColorTypeConverter : TypeConverter 
public ref class RasterColorTypeConverter : public System.ComponentModel.TypeConverter  
class RasterColorTypeConverter(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 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
C#
using Leadtools; 
 
 
public void RasterColorTypeConverterExample() 
{ 
	RasterColor clr; 
 
	// Convert different type of color string representation to RasterColor objects 
	clr = RasterColorTypeConverter.ConvertFromString("Red"); 
	Assert.IsTrue(clr.ToString() == "#FFFF0000"); 
	Console.WriteLine("Red: " + clr.ToString()); 
 
	clr = RasterColorTypeConverter.ConvertFromString("BLUE"); 
	Assert.IsTrue(clr.ToString() == "#FF0000FF"); 
	Console.WriteLine("BLUE: " + clr.ToString()); 
 
	clr = RasterColorTypeConverter.ConvertFromString("#F3AABBCC"); 
	Assert.IsTrue(clr.ToString() == "#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); 
	Assert.IsTrue(clr.ToString() == temp); 
	Console.WriteLine(temp + ": " + clr.ToString()); 
} 
Requirements

Target Platforms

Help Version 22.0.2023.5.16
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.