DotNet BackGroundWorker and setclipboardBitmap function
Hi to all.
Thank LoneRobot for his post MultiThreading in 3D Studio Max using the BackgroundWorker class
I'm trying to use DotNet BackGroundWorker to add bitmaps to Imagelist
As is known dotNet supports only for few image formats
But there is a trick: you can open a picture with 3ds Max (openbitmap) and then put it into clipboard (setclipboardBitmap)
Then open it with the command
((DotNetClass "System.Windows.Forms.Clipboard").GetImage())
It works in this example: http://www.scriptspot.com/files/GetClipBoardImage.ms
But when using BackGroundWorker bitmap is not loaded into the clipboard.
Fn WorkThread sender e = ( for i = 1 to fileArray do ( my_img=openbitmap fileArray[i] if my_img != undefined then ( setclipboardBitmap my_img format "ClipBoardImage: %\n" ((DotNetClass "System.Windows.Forms.Clipboard").ContainsImage()) ) ) )
--------------------------------------
Regards,
Alexander
Attachment | Size |
---|---|
GetClipBoardImage.ms | 1.02 KB |
Comments
The solution is found. The
The solution is found.
The most difficult task (opening image), we solve using BackgroundWorker.
After adding all bitmaps in the array we put them into the clipboard.
dotNet.addEventHandler MainThread "RunWorkerCompleted" ShowBitmap