Hi all,

I am french reseller of Rhino and I make my first plug-in into Rhino in C#
Here is my issue :
To make thumbnails of windows files I used a lot without troubles this routine :
Bitmap myBitmap = myThumb.GetThumbnail(file.FullName);

For unknown reasons it doesn't works with Rhino V4 SDK :-(

So I try to use the follwing code : 

http://wiki.mcneel.com/developer/sdksamples/extractthumbnail

but I don't know how to convert a Rhino type ONWindows Bitmap in .NET Bitmap type to display the thumbnail in a PictureBox.
Any help will be appreciated.


Philippe

CADLINK

Paris, France 

 

Views: 335

Replies to This Discussion

Found the soluce with a sample of Dale Fugier.

static public Bitmap Create(OnWindowsBitmap on_bitmap)
{
if (null == on_bitmap || on_bitmap.Width() < 1 || on_bitmap.Height() < 1)
return null;
Bitmap result = null;
try
{
result = new Bitmap(on_bitmap.Width(), on_bitmap.Height(), System.Drawing.Imaging.PixelFormat.Format24bppRgb);
if (null != result)
for (int y = 0; y < result.Height; y++)
for (int x = 0; x < result.Width; x++)
result.SetPixel(x, y, on_bitmap.Pixel(x, y));
}
catch (Exception exception)
{
System.Diagnostics.Debug.WriteLine(exception.Message + "\n" + exception.StackTrace);
}
return result;
}

 

RSS

Translate

© 2014   Created by McNeel Admin.

Badges  |  Report an Issue  |  Terms of Service