Profile Picture

Current thread must be set to single thread apartment (STA)

Posted By Mike O'Ceirin 4 Years Ago

Current thread must be set to single thread apartment (STA)

Author
Message
Mike O'Ceirin
Problem Posted 4 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 22, Visits: 184
I am trying to put a chart image into the clipboard. It seems it requires single threading how do I implement this? It occurs in debug mode and also occurs when the asp.net project is published on the net. How can I implement it please.
I get the message in the subject line when I try to run the following code
   protected void ChartClip_Click(object sender, EventArgs e)
   {
    NImageExporter imageExporter = this.chartControl.ImageExporter;
    imageExporter.CopyToClipboard(imageExporter.DefaultImageSize, NResolution.ScreenResolution, new NJpegImageFormat());
   }


Nevron Support
Posted 4 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Mike,

This code will copy the chart image to the clipboard on the server.

In case you want to put the image on the clients' clipboard, you'll need to implement a custom command and custom request. The custom request will send a message to the server to generate a rasterized image, and the custom command will place the rasterized image on the clipboard on the client. Check out the Custom Commands and Custom Requests example. Alternatively, you can simply put a toolbar that allows the user to save the chart image in png or bmp format.

We hope this helps - let us know if you meet any problems or have any questions.


Best Regards,
Nevron Support Team



Mike O'Ceirin
Posted 4 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 22, Visits: 184
This feature if it is only going to work when one is logged into the server it does not seem to have a lot of point. I thought you might mean it would work for a user directly using the website. I haven't tested it but if it works one would have to be logged into the server and then run it.

I don't want to get involved with creating a new custom control so I will try the toolbar which seemed to me to be somewhat overkill. Providing a facility to use a copy of the chart in other applications for documentation purposes is quite important though.

Thanks for the advice I will add the toolbar.

Mike O'Ceirin
Posted 4 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 22, Visits: 184
Yes that is a solution thank you.

Nevron Support
Posted 4 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Mike,
We're glad everything is working properly. Just to clarify on the previous post - the image exporter copy to clipboard feature is used in desktop apps only (WinForms, WPF) and is not intended to work in web forms. If you meet any problems with the proposed solution please let us know.


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic