我已经为maxscript编写了这个自定义消息框,我想知道是否可以移动此模式对话框。
我认为这不会在本机上暴露给此类控件。
我尝试过mb.location
和mb.height
(只是为了检查),但是消息框没有这些属性。
除此之外,我很困惑。
我要控制位置的原因是在鼠标位置打开任何消息框。
评论和我尝试过的内容可以在代码中找到。
clearListener()
struct ST_customMessageBox
(
fn fn_dotNetMsgBox caption:"Default Caption" msg:"Default Message" iconType:#None buttonType:#YesNoCancel =
(
local mb = DotNetClass "MessageBox"
local icon = (execute("(DotNetClass \"MessageBoxIcon\")." + iconType))
local msgbutton = (execute("(DotNetClass \"MessageBoxButtons\")." + buttonType))
local result = mb.show msg caption msgbutton icon
-- this below will return the current position of the mouse
print mouse.screenpos
-- move the messagebox to the mouse position.
-- the .location property does not exist.
try(print (result.location))catch(print"No location here my friend")
return (result.ToString())
)
)
customMessageBox = ST_customMessageBox()
answer = customMessageBox.fn_dotNetMsgBox caption:"Caption..." msg:"Message goes here.\n\n2nd line." iconType:#Question buttonType:#YesNoCancel
-- if answer == "Yes" then format "Yes pressed\n"
-- if answer == "No" then format "No pressed\n"
-- if answer == "Cancel" then format "Cancel pressed\n"