This is what I achieved:
{
panelmain.Controls.Add(abc);
panelmain.Controls.Add(grid1);
string toexport;
toexport = RenderCo
You may have misinterpreted the documentation of ConvertFromString
here, explanation:
You are using an ImageformatConverter class which inherits and overrides TypeConverter. This means that ConvertFromString
is inherited from the superclass, but because there's no way you can convert a string to an image (unless you have a vivid imagination), this method always returns null (according to documentation), or throws a NotSupportedException
. This is the default behavior of the base class and an overriding class can define custom behavior, which in your case, has not been done.
To convert from a string you will first have to define what you want. I.e., is the string a path to an image? Is it a piece of text and you want to render an image from that? Is it a Base64 encoded string that contains an image? Is it a rendered HTML page or does it contain an RTF document? Once you have an answer to these questions, you can choose the correct converter or image constructor.
EDIT: because your question seems to be about rendering HTML as an image, check out this post at SO, as also mentioned by rchern above.