←Select platform

ConvertFromString Method

Summary
Converts the specified text to a RasterColor object.
Syntax
C#
C++/CLI
Python
public static RasterColor ConvertFromString( 
   string value 
) 
public: 
static RasterColor ConvertFromString(  
   String^ value 
)  
def ConvertFromString(self,value): 

Parameters

value
A String containing the text value. This must be an HTML compatible string representation of a color.

Return Value

The RasterColor this method creates. If the string is null, then an empty RasterColor will be returned with all color components set to zero.

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.