[Closed] dotNetControl PictrueBox 's Problem~
hey~
I wanto display a image in a dotNetControl like this but it not work~ who knows what’s wrong??
code:
dotNetControl uiPictureBox “System.Windows.Forms.PictureBox” pos:[10,10] width:100 height:100 image:(dotNetObject “System.Drawing.Bitmap” “d:\IMAGE_157.jpg”)
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
)
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.