Notifications
Clear all
[Closed] Asynchronous timer/Form fade
Oct 16, 2015 8:14 am
Please help me make an asynchronous animation of form opacity, it should depend on a timer.
When Max is making some operations, my form may hang.
Here is the code:
(
Local CollectInformationForm
Local displayTime = 75
fn defPoint x y = (dotNetObject "System.Drawing.Point" x y)
fn defSize x y = (dotNetObject "System.Drawing.Size" x y)
fn defForm dnForm = --main form
(
dnForm.ShowInTaskbar = false
dnForm.ClientSize = defSize 400 50
dnForm.StartPosition = dnForm.StartPosition.Manual
dnForm.DesktopLocation = defPoint 3 200
dnForm.FormBorderStyle = dnForm.FormBorderStyle.None
dnForm.Opacity=0
)
fn maxHW =
(
thePtr = DotNetObject "System.IntPtr" (Windows.GetMAXHWND())
if 1998+((maxversion())[1]/1000)>2014 then
(dotnetclass "System.Windows.Forms.Control").fromHandle thePtr
else
DotNetObject "MaxCustomControls.Win32HandleWrapper" thePtr
)
fn createInfoTablo =
(
CollectInformationForm=dotNetObject "form"
defForm CollectInformationForm
dotNet.setLifeTimeControl CollectInformationForm #dotNet
CollectInformationForm.Show (maxHW())
)
local net_tm = dotnetobject "Timer"
net_tm.Interval = 30
counter=0
fn onTick s a =
(
if counter < 20 then
CollectInformationForm.Opacity+=0.05
if counter > displayTime-20 then
CollectInformationForm.Opacity-=0.05
if counter < displayTime then
(
counter+=1
)
else
(
s.Stop()
net_tm.dispose()
CollectInformationForm.close()
)
)
dotnet.addEventHandler net_tm "Tick" onTick
createInfoTablo()
net_tm.Start()
)
3 Replies
Oct 16, 2015 8:14 am
Friends, please help me. It is not because I’m lazy to try by myself, I have tried different methods but I get errors.
Oct 16, 2015 8:14 am
I wish I could help you as a thanks for the help you gave me, but sadly this is way to complicated for me