Notifications
Clear all

[Closed] Question about max viewport custom ui tools

hi guys, is there any way to create custom ui tool on viewport? like the buttons in the picture below:
image
if anyone knows please give me a hint, mxs mcg or c#? thanks!!!

2 Replies

you can use transparent form to place any controls

try (::maxform.close();::maxform.dispose()) catch()
maxform = dotNetObject "System.Windows.Forms.Form"
maxform.BackColor = maxform.BackColor.black
maxform.TransparencyKey = maxform.BackColor.black
hwnd = DotNetObject "MaxCustomControls.Win32HandleWrapper" (dotNetObject "System.IntPtr" (windows.getMAXHWND()))

maxform.StartPosition = maxform.StartPosition.Manual
maxform.ShowIcon = false
maxform.TabStop = false
maxform.showInTaskBar = false
maxform.MinimizeBox = false
maxform.MaximizeBox = false
maxform.ControlBox = false
maxform.FormBorderStyle = maxform.FormBorderStyle.None
	
	
btn = dotnetobject "system.windows.forms.button"
maxform.controls.add btn

maxform.autosizemode = maxform.autosizemode.GrowAndShrink
maxform.autosize = true
btn.autosize = true
btn.autosizemode = btn.autosizemode.GrowAndShrink

url = @"http://icons.iconarchive.com/icons/dtafalonso/android-l/256/Chrome-Beta-icon.png"

fn getImageFromWeb url resize: =
(	
	request = (dotnetclass "system.net.WebRequest").Create url
	response = request.GetResponse()
	stream = response.GetResponseStream()

	img = (dotnetclass "System.Drawing.Bitmap").FromStream stream
	
	if isKindOf resize point2 then
	(
		dotNetObject "system.drawing.image" (dotNetObject "system.drawing.bitmap" img (dotNetObject "system.drawing.size" resize.x resize.y))
		
	) else img
)

btn.image = getImageFromWeb url resize:[64,64]

maxform.location = dotNetObject "System.Drawing.Point" 333 333
maxform.show hwnd

oh oh thanks ,i will try it