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


Author
Message
Mike O'Ceirin
Mike O'Ceirin
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
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
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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
Mike O'Ceirin
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
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
Mike O'Ceirin
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
Posts: 22, Visits: 184
Yes that is a solution thank you.
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search