XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : dotNetControl PictrueBox 's Problem~

12-23-2010, 03:24 AM

I wanto display a image in a dotNetControl like this but it not work~ who knows what's wrong??


dotNetControl uiPictureBox "System.Windows.Forms.PictureBox" pos:[10,10] width:100 height:100 image:(dotNetObject "System.Drawing.Bitmap" "d:\\IMAGE_157.jpg")

12-23-2010, 07:22 AM
This works for me! You can also mess around with the .backgroundImageLayout property to have your image fit the size of the picture box.

rollout windowPictureBox "Picture box"
dotNetControl pictureBox "System.Windows.Forms.PictureBox" height:100 width:100 align:#center

on windowPictureBox open do
imageFile = @"C:\Program Files (x86)\Autodesk\3ds Max 2008\ui\Icons\AtmosApp_24i.bmp" -- Point this to an image you want to use
if (doesFileExist imageFile) do
imageObject = (dotNetClass "System.Drawing.Image").fromFile imageFile
pictureBox.backGroundImage = imageObject
pictureBox.backgroundImageLayout = (dotNetClass "System.Windows.Forms.ImageLayout").zoom
createDialog windowPictureBox 150 150

12-23-2010, 09:47 AM
Unlike max usercontrols, you can only pass height, width and position to a dotnetcontrol's constructor. Any other properties should be defined in the on open handler of the rollout (just like jason's code), or the load event of a maxform/windows form.

Just thought I'd mention another picturebox option - the image property accepts a dotnet bitmap or image, but there is another property called imagelocation that opens a file from a path string.

CGTalk Moderation
12-23-2010, 09:47 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.