[Closed] Can I show an animated GIF in a MXS window?
Does maxscript support animated GIFs?
If yes, can you please give me a code snippet that creates a window with the gif-image in it?
(
global rol_miauuInstaller
--
local lab_splashScreen
local splashscreenGIF = @"D:\SplineDeformSplash.gif"
function SetControlPosition posX posY =
(
dotNetObject "System.Drawing.Point" posX posY
)
function SetControlSize width height =
(
dotNetObject "System.Drawing.Size" width height
)
function BuildRollout rol title: width: height: =
(
rol.text = title
rol.ClientSize = SetControlSize width height
rol.StartPosition = rol.StartPosition.CenterScreen
rol.AllowTransparency = true
rol.ShowInTaskbar = true
)
function BuildLabel label posX: posY: width: height: txt: =
(
label.bounds=(dotNetObject "system.drawing.rectangle" posX posY width height)
)
rol_miauuInstaller = dotnetobject "Form"
BuildRollout rol_miauuInstaller title:"animatedGif" width:432 height:180
lab_splashScreen = dotNetObject "Label"
BuildLabel lab_splashScreen posX:0 posY:0 width:432 height:150 txt:""
lab_splashScreen.image = (dotNetclass "System.Drawing.Image").fromfile splashscreenGIF
rol_miauuInstaller.Controls.AddRange #(lab_splashScreen)
rol_miauuInstaller.topMost = true
rol_miauuInstaller.Show()
try(dotNet.setLifeTimeControl rol_miauuInstaller #dotNet)catch()
)
Thank you very much @miauu, this is spot on!
How can I prevent resize of the window?
Does it have to be dotNet? The windows overlays on top of everything, even when you minimize 3dsMax. I am wondering if maxscript did not support gif:s at all?
edit: can the dotNet window be merged inside a regular maxscript generated
I noticed there is HTML support in MaxScript.
The whole purpose for this question is to put a [?] button that leads you to an animated GIF that explains how the tool works. One GIF might say more than a thousand words, right?
This is how far I got (please see the attached files below)
FaceToElements.html (30 Bytes)
rollout img_rollout "Quick Manual" width:540 height:330
(
dotNetControl wb "System.Windows.Forms.WebBrowser" pos:[0,00] width:540 height:330
on img_rollout open do (
wb.navigate "C:\FaceToElements.html"
)
)
createdialog img_rollout
I would rather not have to bundle each GIF with an HTML file, if I don’t have to. Maybe Maxscript does support a predefined HTML code, eg instead of using an html-file, we could type in the html-code directly, like or if we must.
What do you think?
(
global rol_
try(destroyDialog rol_)catch()
rollout rol_ "MaxRollout + Animated GIF"
(
local splashscreenGIF = @"D:\SplineDeformSplash.gif"
dotNetControl dn_flp "flowlayoutpanel" height:241 width:432
dotNetControl btn_LengthDistance "System.Windows.Forms.button" width:432 height:241
on rol_ open do
(
btn_LengthDistance.margin = dotnetobject "padding" 0
btn_LengthDistance.FlatAppearance.BorderSize = 1
btn_LengthDistance.flatstyle = (dotNetclass "FlatStyle").flat
btn_LengthDistance.image = (dotNetclass "System.Drawing.Image").fromfile splashscreenGIF
dn_flp.Controls.Clear()
dn_flp.SuspendLayout()
dn_flp.controls.addrange #(btn_LengthDistance)
dn_flp.resumelayout()
)
)
createdialog rol_ width:460 height:261
)