Notifications
Clear all

[Closed] Remove inset from bitmap displayed in rollout?

I am just wondering if its possible to load a bitmap into a rollout that is not “inset”. Right now it as a 3d look.

Thanks.

15 Replies

imgbox’s have no border.

they may not have borders but they look like they are pushed into the screen to give it a 3d look. I would like to remove that.

I think he may have meant “imgtag”. That’s a different UI element – like a “bitmap” UI element, but without the borders and lots of mouseover/clicky/etc. goodness.

you could also use the background image property of a dotnet label control, this too would not have a border.

Thanks. I can’t believe I didn’t see the imgtag… I have a few questions.

  1. Are imgtags displayed the same way as the standard bitmap element? I want to make sure that what you see in the rollout is the same as what you see in the frame buffer window and the same as the original image file.

  2. Can you use the mousemove event? Right now my script scrolls through images using the mouse pos.x. But with the imgtag I cannot seem to do this. There are so many other events for this element but none for mousemove?

  3. Certain colours of the image are transparent. The help files did not say if you could turn this off, only that you can change which colours are transparent…

  4. Below is a script that displays an image using a DotNet picturebox. I found this script on the forums and modified it a bit. Is this code the correct way of displaying an image using DotNet?
    Is the image displayed (using DotNet) uncompressed and displayed the same as what I would see in the frame buffer window or in the original image file?

If I use the imgtag method there’s very little extra coding required. DotNet might require a lot more changes to my script.


 
(
 
 
local Image_path = "D:\image2.png"
local Image = openbitmap "D:\image2.png"
local bmpDisplayed = dotNetObject "System.Drawing.Bitmap" Image_path
local bmpRectangle = dotNetObject "System.Drawing.Rectangle" 0 0 Image.width Image.height
 
rollout PictureBox_Rollout "PictureBox_Rollout"
(
dotNetControl uiPictureBox "System.Windows.Forms.PictureBox" pos:[0,0] width:Image.width height:Image.height
 
fn updateZoom =
( Image_path = "D:\image1.png"
bmpDisplayed = dotNetObject "System.Drawing.Bitmap" Image_path
uiPictureBox.Width = Image.width
uiPictureBox.Height = Image.height
uiPictureBox.Invalidate()
)
 
on uiPictureBox Paint senderArg paintEventArgs do
(
Graphics = paintEventArgs.Graphics
Graphics.DrawImage bmpDisplayed bmpRectangle
)
 
on uiPictureBox mouseMove pos do
(
val = 100.0*((pos.x/PictureBox_Rollout.width as float))
print val
 
)
on PictureBox_Rollout mouseMove pos do
(
 
 
val = 100.0*((pos.x/PictureBox_Rollout.width))
print val 
)
 
 
)
 
createdialog PictureBox_Rollout width:800 height:800
)

Thanks for the help. My script is basically done and I have learned quite a bit from you guys. Hopefully I won’t have many more questions.

more or less… remember, there’s no borders. In addition…

Correct. You can set it to some rather unlikely color (say, (color 3 1 2)), but any image that does have that unlikely color will have that set transparent. I’ve pondered this myself and haven’t spotted any method to tell the thing that you don’t want any transparency at all.

Nope. The imgtag will intercept the mousemove event – while the events that intercept it, themselves, don’t report your mouse cursor’s position. You can correlate this from the mouse’s screen position, but it’s not pretty and involves using a timer and such.

Perhaps some dirty UI work would be better (short of the dotNET route, obviously)… e.g.


rollout unnamedRollout "Untitled" width:160 height:128
(
	bitmap bmp1 "Bitmap" pos:[32,32] width:80 height:72
	label lbl1 "" pos:[16,18] width:112 height:16
	label lbl2 "" pos:[16,102] width:112 height:16
	label lbl3 "" pos:[18,32] width:16 height:72
	label lbl4 "" pos:[110,32] width:16 height:72
	
	on unnamedRollout open do (
		bmp1.bitmap = rendermap (noise()) scale:200
	)
)
createDialog unnamedRollout

( yes, that’s label controls obscuring the bitmap control’s borders. yuck. )

I usually use the background color as transparent. it’s like 124 or something. That way if it’s transparent… they see the exact same color. or else pure green. Pure green is an all time favorite.

1 Reply
(@cyclones)
Joined: 11 months ago

Posts: 0

Yea. I thought of that but I decided not to use imgtags. I would rather the image just be displayed the way it is and the mousemove thing won’t work either.

I tried the label idea and it did the job but since you cannot dynamically change the label width/height I had to set the defaults to a large number like 10000… and because of that the labels go overtop of all the buttons and progress bar in the rollout and they flicker. If only you could change the size after the rollout was created.

I guess my last option is to try DotNEt? I hope it won’t make the script slow.

well… one other option is to just live with the borders

dotNET wouldn’t make things particularly slower… it does mean having to keep track of two different languages and nixing any pre-R9 support (should that be an issue). Does the mousemove event trigger over dotnet controls, though? (haven’t tried)

1 Reply
(@lonerobot)
Joined: 11 months ago

Posts: 0

yes it does. the mouse events will yield a mouseeventargs variable which contains the location of the mouse pointer.

With the label control width/height issue, im assuming you dont mean a dotnet label? as you can set the size of these at runtime in any event handler.


rollout test "" width:162 height:300
(
	dotNetControl lab1 "System.windows.forms.label" height:90 width:50 backcolor:cColor.blue
	button btn1 "Big it up" pos:[9,269] width:143 height:23
	
	on test open do lab1.backColor = (dotNetClass "System.Drawing.Color").powderBlue
	
	on btn1 pressed do 
	(
		lab1.size = dotnetobject "System.Drawing.Size" 120 240 
		lab1.backColor = (dotNetClass "System.Drawing.Color").crimson
	)
)
createdialog test

well I meant for the standard maxscript dialog “on mousemove <pos> do ( <code> )” event – not the dotNET events

Page 1 / 2