[Closed] .Net NumericUpDown arrows color
Hi
I tried to use .Net NumericUpDown instead max spinners
There is a little trouble with color of arrows of this control, i can’t assign custom color to it.
It has white (system?) color.
Another colors as backcolor, forecolor are customizable, but arrows are not.
Of course it’s not a big problem but if i have complete dark UI -back, buttons etc -with shining white spinner arrows – it’ not good.
I practice to remove arrows from NumericUpDOwns and use scroll wheel to spin numbers(values). SpinEdit have nicer arrows but still is to big. I not know that you can be able to change arrows colors (style) using mxs.
Here en example
(
global form
try(form.close()) catch()
local sfIdx, clock
fn defColor r g b = ((dotNetClass "System.Drawing.Color").FromArgb r g b)
fn defPoint x y = (dotNetObject "System.Drawing.Point" x y)
fn defSize x y = (dotNetObject "System.Drawing.Size" x y)
fn defRect x y w h = (dotNetObject "System.Drawing.Rectangle" x y w h)
fn defForm dnForm w h x y =
(
dnForm.ShowInTaskbar = false ; dnForm.Text = "Get pixel color" ; dnForm.ClientSize = defSize w h
dnForm.StartPosition = dnForm.StartPosition.Manual ; dnForm.DesktopLocation = defPoint x y
dnForm.FormBorderStyle = dnForm.FormBorderStyle.FixedSingle
dnForm.MaximizeBox = dnForm.MinimizeBox = off
)
fn defDevXSpn dnSpn w h x y cutArrows:off =
(
dnSpn.ClientSize = dotNetObject "System.Drawing.Size" w h
dnSpn.Location = dotNetObject "System.Drawing.Point" x y
dnSpn.backcolor = defColor 28 28 28 ; dnSpn.forecolor = defColor 180 180 180
if cutArrows do dnSpn.Region = dotNetObject "System.Drawing.Region" (defRect 0 0 (w-20) h)
dnSpn.BorderStyle = dnSpn.BorderStyle.NoBorder --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
)
fn defSpinner dnSpn w h locX locY inc: dp: minV: maxV: val: cutArrows:off =
(
dnSpn.ForeColor = defColor 180 180 180 ; dnSpn.BackColor = defColor 28 28 28
dnSpn.Bounds = defRect locX locY w h
if cutArrows do (dnSpn.Region = dotNetObject "System.Drawing.Region" (defRect 0 0 (w-20) h) ; dnSpn.AutoSize = true)
dnSpn.DecimalPlaces = dp ; dnSpn.Minimum = minV ; dnSpn.Maximum = maxV ; dnSpn.Value = val
dnSpn.BorderStyle = dnSpn.BorderStyle.none ; dnSpn.Increment = inc
)
form = dotnetobject "MaxCustomControls.Maxform" ; defForm form 200 60 10 110
devXSpinner1 = dotNetObject "DevExpress.XtraEditors.SpinEdit" ; defDevXSpn devXSpinner1 100 20 5 5 cutArrows:on
devXSpinner2 = dotNetObject "DevExpress.XtraEditors.SpinEdit" ; defDevXSpn devXSpinner2 80 20 100 5
netSpinner1 = dotNetObject "NumericUpDown" ; defSpinner netSpinner1 100 20 5 30 inc:1 dp:3 minV:0 maxV:100 val:50 cutArrows:on
netSpinner2 = dotNetObject "NumericUpDown" ; defSpinner netSpinner2 80 20 100 30 inc:1 dp:2 minV:-50 maxV:10 val:-10
-----------------------------------------------------------------------------------------------------
form.Controls.AddRange #(devXSpinner1, devXSpinner2, netSpinner1, netSpinner2)
form.showmodeless() ; ok
)
Wow, thanks, man .
Can I ask you about:
- What kind of control is “DevExpress.XtraEditors.SpinEdit” ? I didnt hear about it
- Can I add it in max rollout, not form? if no, maybe with add it to panel or container control?
Thanks
Maybe someone can explain better DevExprees. Optimized Feature-Rich Easy-to-UseControls. And yes you can use it with rollout dialog as dotnetcontrol.
Max2012+ have a few devX assemblys. You can explore more about supported devX controls using Alexander Kramer “Show .Net Property” script. I add a couple of lines for devX. Run script in the attachement then from first dropdown list choose “DevExpress.XtraEditors.v10.1“, press “Load” and in 2nd dropdown you will see what’s max have inside. You can choose “DevExpress.XtraEditors.SpinEdit” and press “Print” button to get all Properties, Methods and Events of this particular control.
If you use version of max2011 then version of devX assemblies are 7.1. I don’t know for max2010. I think that devX is not supported.
Ok. But version 10.1 have very nice feature: Gradient Coloring without Paint Event, HTML formating, super tooltips (place mouse over “Press” check button) etc.
I tested only this but who knows what devX hide more under the hood
if dxForm != undefined then try(dxForm.Close())catch()
(
fn AddRangeFn gObj mxsArr = (for i in 1 to mxsArr.count do gObj.Items.Add (dotNetObject "System.String" mxsArr[i]))
fn labelDef dnLbl w h Pnl locX locY bgClr fgClr txt =
(
dnLbl.Width = w ; dnLbl.Height = h ; dnLbl.Location = defPoint (Pnl.pos.x + locX) (Pnl.pos.y + locY)
dnLbl.BackColor = bgClr ; dnLbl.BorderStyle = bStyle ; dnLbl.ForeColor = fgClr ; dnLbl.Text = txt
)
fn defLGradientBrush rect topClr downClr lgMode = (dotNetObject "System.Drawing.Drawing2D.LinearGradientBrush" rect topClr downClr lgMode)
fn defSolidBrush clr = (dotNetObject "System.Drawing.SolidBrush" clr)
fn defColor r g b = ((dotNetClass "System.Drawing.Color").FromArgb r g b)
fn defRect x y w h = (dotNetObject "System.Drawing.Rectangle" x y w h)
fn DisableAccel = (enableAccelerators = false) ; fn EnableAccel = (enableAccelerators = true)
local Fnt = dotNetObject "System.Drawing.Font" "Tahoma" 7 ((dotNetClass "System.Drawing.FontStyle").bold)
local BG = (dotNetClass "System.Drawing.Color").FromArgb 28 28 28
local BG1 = (dotNetClass "System.Drawing.Color").FromArgb 60 60 60
local FG = (dotNetClass "System.Drawing.Color").FromArgb 180 180 180
local gLGMv = (dotNetClass "System.Drawing.Drawing2D.LinearGradientMode").Vertical
--gi = (dotNetclass "System.Globalization.CultureInfo").InvariantCulture
dxForm = dotNetObject "DevExpress.XtraEditors.XtraForm"
dxForm.ClientSize = dotNetObject "System.Drawing.Size" 310 400
dxForm.TopMost = true ; dxForm.AllowFormSkin = true ; --dxForm.Opacity = 0.5d0
dxForm.FormBorderStyle = (dotnetclass "FormBorderStyle").FixedToolWindow
dxForm.Text = "Test" ; dxForm.ShowInTaskbar = false
dxForm.BackColor = BG1
local deListBox = dotNetObject "DevExpress.XtraEditors.ListBoxControl"
deListBox.appearance.backcolor = deListBox.appearance.backcolor.FromArgb 50 50 50
deListBox.appearance.backcolor2 = deListBox.appearance.backcolor.FromArgb 25 25 25
deListBox.appearance.forecolor = deListBox.appearance.forecolor.FromArgb 220 220 220
deListBox.appearance.GradientMode = gLGMv
deListBox.margin = (dotNetObject "padding" 0)
deListBox.size = (dotnetobject "System.Drawing.Size" 310 85)
deListBox.items.addRange #("Apply", "wirecolor" ,"when", "renaming","NewLine")
local deLabel1 = dotNetObject "DevExpress.XtraEditors.LabelControl"
deLabel1.Size = dotNetObject "System.Drawing.Size" 200 100
deLabel1.Location = dotNetObject "System.Drawing.Point" 5 260
deLabel1.Text = "<size=14>Size = 14<br>" + "<b>Bold</b> <i>Italic</i> <u>Underline</u><br>" + "<size=11>Size = 11<br>" + "<color=50, 100, 150>Sample Text</color></size>"
deLabel1.BorderStyle = deLabel1.BorderStyle.Simple
deLabel1.AllowHtmlString = true
deLabel1.Appearance.TextOptions.WordWrap = deLabel1.Appearance.TextOptions.WordWrap.Wrap
deLabel1.Appearance.Options.UseTextOptions = true
deLabel1.AutoSizeMode = deLabel1.AutoSizeMode.None
local deSuperTip = dotNetObject "DevExpress.Utils.SuperToolTip"
local args = dotNetObject "DevExpress.Utils.SuperToolTipSetupArgs";
args.Title.Text = "<size=11><color=50,100,150> New Feature</color>";
args.Contents.Text = "This <size=11><color=250,100,150><b>SuperToolTip</b></color></size> supports <i>HTML formatting</i>"
deSuperTip.DistanceBetweenItems = 0
deSuperTip.Setup args
deSuperTip.AllowHtmlText = deSuperTip.AllowHtmlText.True
args.Title.appearance.backcolor = args.Title.appearance.backcolor.FromArgb 50 50 50
args.Title.appearance.backcolor2 = args.Title.appearance.backcolor.FromArgb 25 25 25
args.Title.appearance.GradientMode = gLGMv
local deCheckEditSolo = dotNetObject "DevExpress.XtraEditors.CheckEdit"
deCheckEditSolo.Location = dotNetObject "System.Drawing.Point" 60 90
deCheckEditSolo.Size = dotNetObject "System.Drawing.Size" 21 21
deCheckEditSolo.Text = "" ; deCheckEditSolo.SuperTip = deSuperTip
deCheckEditSolo.BorderStyle = deCheckEditSolo.BorderStyle.NoBorder --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
local deCheckEditLabeled = dotNetObject "DevExpress.XtraEditors.CheckEdit"
deCheckEditLabeled.Location = dotNetObject "System.Drawing.Point" 90 90
deCheckEditLabeled.ClientSize = dotNetObject "System.Drawing.Size" 100 20
deCheckEditLabeled.Text = "checkBox"
deCheckEditLabeled.BorderStyle = deCheckEditLabeled.BorderStyle.NoBorder --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
deCheckEditLabeled.backcolor = BG ; deCheckEditLabeled.forecolor = FG
local thePopUpCnt = dotNetObject "DevExpress.XtraEditors.PopupContainerControl" --the panel holds the buttons
thePopUpCnt.AutoSizeMode = thePopUpCnt.AutoSizeMode.GrowAndShrink
thePopUpCnt.MaximumSize = dotNetObject "System.Drawing.Size" 220 78
local deCheckButton = dotNetObject "DevExpress.XtraEditors.CheckButton"
deCheckButton.Size = dotNetObject "System.Drawing.Size" 50 20
deCheckButton.Location = dotNetObject "System.Drawing.Point" 5 90
deCheckButton.text = "Press" ; deCheckButton.Enabled = true
deCheckButton.appearance.backcolor = deListBox.appearance.backcolor.FromArgb 100 140 200
deCheckButton.appearance.backcolor2 = deListBox.appearance.backcolor.FromArgb 60 100 160
deCheckButton.appearance.forecolor = deListBox.appearance.forecolor.FromArgb 0 0 0
deCheckButton.appearance.bordercolor = deCheckButton.appearance.bordercolor.FromArgb 0 0 0
deCheckButton.ButtonStyle = deCheckButton.ButtonStyle.HotFlat --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
deCheckButton.appearance.GradientMode = gLGMv ; deCheckButton.AllowFocus = false ; deCheckButton.SuperTip = deSuperTip
local deFontEdit = dotNetObject "DevExpress.XtraEditors.FontEdit"
deFontEdit.Location = dotNetObject "System.Drawing.Point" 5 200
deFontEdit.Size = dotNetObject "System.Drawing.Size" 150 20
deFontEdit.BackColor = BG ; deFontEdit.ForeColor = FG
deFontEdit.BorderStyle = deFontEdit.BorderStyle.UltraFlat --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
deFontEdit.properties.items.addRange #("Apply", "wirecolor" ,"when", "renaming","bane")
local deFontZTB = dotNetObject "DevExpress.XtraEditors.ZoomTrackBarControl"
deFontZTB.Location = dotNetObject "System.Drawing.Point" 120 362
deFontZTB.Size = dotNetObject "System.Drawing.Size" 150 20
deFontZTB.BackColor = BG ; deFontZTB.AutoSizeInLayoutControl = true
deFontZTB.Properties.BorderStyle=deFontZTB.Properties.BorderStyle.NoBorder
local deComboBoxEdit = dotNetObject "DevExpress.XtraEditors.ComboBoxEdit"
deComboBoxEdit.Location = dotNetObject "System.Drawing.Point" 5 230
deComboBoxEdit.Size = dotNetObject "System.Drawing.Size" 120 20
deComboBoxEdit.BackColor = BG ; deComboBoxEdit.ForeColor = FG
deComboBoxEdit.BorderStyle = deComboBoxEdit.BorderStyle.Simple --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
deComboBoxEdit.properties.AppearanceDropDown.backcolor = defColor 50 50 50
deComboBoxEdit.properties.AppearanceDropDown.backcolor2 = defColor 25 25 25
deComboBoxEdit.properties.AppearanceDropDown.forecolor = defColor 220 220 220
deComboBoxEdit.properties.Appearance.bordercolor = deComboBoxEdit.properties.AppearanceDropDown.bordercolor = defColor 60 100 160
deComboBoxEdit.properties.AppearanceDropDown.GradientMode = gLGMv
deComboBoxEdit.properties.PopupBorderStyle = deComboBoxEdit.properties.PopupBorderStyle.Simple
deComboBoxEdit.properties.Appearance.Font = deComboBoxEdit.properties.AppearanceDropDown.Font = Fnt
deComboBoxEdit.properties.items.addRange #("Apply", "wirecolor" ,"when", "renaming","bane")
deComboBoxEdit.SelectedIndex=0
deComboBoxEdit.properties.TextEditStyle = deComboBoxEdit.properties.TextEditStyle.DisableTextEditor --HideTextEditor
local deCalcEdit = dotNetObject "DevExpress.XtraEditors.CalcEdit"
deCalcEdit.Location = dotNetObject "System.Drawing.Point" 160 200
deCalcEdit.Size = dotNetObject "System.Drawing.Size" 150 20
deCalcEdit.BackColor = BG ; deCalcEdit.ForeColor = FG
deCalcEdit.BorderStyle = deCalcEdit.BorderStyle.UltraFlat --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
local deLabel = dotNetObject "DevExpress.XtraEditors.LabelControl"
deLabel.Size = dotNetObject "System.Drawing.Size" 100 16
deLabel.Location = dotNetObject "System.Drawing.Point" 5 115
deLabel.text = " Label Control" ; --deLabel.AutoSizeInLayoutControl = true
deLabel.AutoSizeMode = deLabel.AutoSizeMode.None
deLabel.appearance.backcolor = deListBox.appearance.backcolor.FromArgb 100 140 200
deLabel.appearance.backcolor2 = deListBox.appearance.backcolor.FromArgb 50 100 150
deLabel.appearance.forecolor = deListBox.appearance.forecolor.FromArgb 0 0 0
deLabel.appearance.GradientMode = gLGMv ; deLabel.Enabled = true ; deLabel.Font = Fnt
local deMarquee = dotNetObject "DevExpress.XtraEditors.MarqueeProgressBarControl"
deMarquee.Size = dotNetObject "System.Drawing.Size" 150 10
deMarquee.Location = dotNetObject "System.Drawing.Point" 150 230
deMarquee.text = " Label Control" ; deMarquee.InplaceType = deMarquee.InplaceType.Standalone
deMarquee.backcolor = BG ; deMarquee.forecolor = FG
deMarquee.BorderStyle = deMarquee.BorderStyle.NoBorder --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
deMarquee.Enabled = on
local theButton = dotNetObject "DevExpress.XtraEditors.SimpleButton"
local LGMv = (dotNetClass "System.Drawing.Drawing2D.LinearGradientMode").Vertical
theButton.text = "MULTI | MTL's | MAP's | TOOLS" ; theButton.AllowFocus = false
theButton.size = (dotnetobject "System.Drawing.Size" 185 20)
theButton.Location = dotNetObject "System.Drawing.Point" 100 175
theButton.appearance.backcolor = theButton.appearance.backcolor.FromArgb 100 140 200
theButton.appearance.backcolor2 = theButton.appearance.backcolor2.FromArgb 50 100 150
theButton.appearance.forecolor = theButton.appearance.forecolor.FromArgb 0 0 0
theButton.appearance.bordercolor = theButton.appearance.bordercolor.FromArgb 50 50 50
theButton.appearance.GradientMode = LGMv ; theButton.Font = Fnt
theButton.BorderStyle = theButton.BorderStyle.HotFlat --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
theButton.visible = true ; theButton.font = Fnt
local deMemo = dotNetObject "DevExpress.XtraEditors.MemoEdit"
deMemo.Size = dotNetObject "System.Drawing.Size" 100 30
deMemo.Location = dotNetObject "System.Drawing.Point" 5 140
deMemo.text = " AddNotes"
deMemo.backcolor = BG ; deMemo.forecolor = FG
deMemo.Enabled = true ; deMemo.Font = Fnt
local deMask = dotNetObject "DevExpress.XtraEditors.Mask.MaskBox"
deMask.Size = dotNetObject "System.Drawing.Size" 100 30
deMask.Location = dotNetObject "System.Drawing.Point" 120 120
mt = (dotnetclass "DevExpress.XtraEditors.Mask.MaskType").Regular
--deMask.EditText = " AddNotes"
deMask.BorderStyle = deMask.BorderStyle.none
deMask.backcolor = BG ; deMask.forecolor = FG
deMask.Mask.maskType = mt
deMask.Enabled = true ; deMask.Font = Fnt
local deSpinner = dotNetObject "DevExpress.XtraEditors.SpinEdit"
deSpinner.ClientSize = dotNetObject "System.Drawing.Size" 100 30
deSpinner.Location = dotNetObject "System.Drawing.Point" 110 140
rect = (defRect 0 0 80 30)
deSpinner.Region = dotNetObject "System.Drawing.Region" rect
deSpinner.BorderStyle = deSpinner.BorderStyle.NoBorder --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
deSpinner.backcolor = BG ; deSpinner.forecolor = FG
local txtbox1 = dotNetObject "DevExpress.XtraEditors.TextEdit"
txtbox1.location = dotNetObject "System.Drawing.Point" 5 175
txtbox1.Size = dotNetObject "System.Drawing.Size" 80 100 ; txtbox1.Properties.AutoHeight = true
txtbox1.BorderStyle = txtbox1.BorderStyle.NoBorder --Flat,HotFlat,NoBorder,Office2003,Simple,Style3D,UltraFlat
txtbox1.backcolor = BG ; txtbox1.forecolor = FG ; txtbox1.Text = "TextBox" ; txtbox1.Font = Fnt ; txtbox1.Enabled = true
dxForm.controls.add(deListBox)
dxForm.controls.add(deCheckButton)
dxForm.controls.add(deCheckEditSolo)
dxForm.controls.add(deCheckEditLabeled)
dxForm.controls.add(deFontEdit)
dxForm.controls.add(deComboBoxEdit)
dxForm.controls.add(deCalcEdit)
dxForm.controls.add(deLabel)
dxForm.controls.add(deLabel1)
dxForm.controls.add(deMarquee)
dxForm.controls.add(deMemo)
dxForm.controls.add(deSpinner)
dxForm.controls.add(txtbox1)
dxForm.controls.add(thePopUpCnt)
dxForm.controls.add(theButton)
dxForm.controls.add(deMask)
dxForm.controls.add(deFontZTB)
fn ValueChanged s e =
(
gp = getProperty s #value asDotNetObject:true
floatV = (dotNetClass "System.Decimal").ToSingle gp
print floatV
)
dotnet.addEventHandler deSpinner "ValueChanged" ValueChanged
dotnet.addEventHandler deMemo "GotFocus" DisableAccel
dotnet.addEventHandler deMemo "LostFocus" EnableAccel
dotnet.addEventHandler deMask "GotFocus" DisableAccel
dotnet.addEventHandler deMask "LostFocus" EnableAccel
dxForm.Show()
)
hmmm, looks interesting…
Thanks for example!
Some questions, please:
Is there some critical bugs in this controls when using it in max?
is there any reasons for using these controls instead standart dotnet controls, maybe some magic properties)))?
Reason? No. Keep it simple, always. .NET have some adventages over standard mxs controls. But the rest is not important. What is important is that your tool works smoothly which means well-optimized functions and simple look to helps any users. devX controls is also very powerful and have better looks but are slow when you use a lot of these.
A wise man (DenisT) once said : Keep it simple, because average users are sometimes afraid to use a tool that UI looks awesome. And he is right 100%. Also when you create such tool you will spend 90% time on UI and 10% on functionality. Don’t get me wrong, i love to use .net in combinations with mxs. But only when i have free time
One more funny example of devX script. I do this just for fun. Works well in max 2012+
if (maxversion())[1] > 13000 do
(
global RandomLetters
try(destroydialog RandomLetters) catch()
rollout RandomLetters " IneractiveLabels" width:300 height:120
(
local lbl1, tb1, lbl2, tb2, cb, dnClock
dotNetControl mxsPnl "MaxCustomControls.MaxUserControl" pos:[0,0]
fn DisableAccel = (enableAccelerators = false) ; fn EnableAccel = (enableAccelerators = true)
fn dxCalcGF = (DisableAccel()) ; fn dxCalcLF = (EnableAccel())
fn defPoint x y = (dotNetObject "System.Drawing.Point" x y)
fn defSize x y = (dotNetObject "System.Drawing.Size" x y)
fn defColor r g b = ((dotNetClass "System.Drawing.Color").FromArgb r g b)
fn defFont fName fSize = (dotNetObject "System.Drawing.Font" fName fSize ((dotNetClass "System.Drawing.FontStyle").bold))
local clr1 = (defColor 40 40 40), clr2 = (defColor 0 0 0), clr3 = (defColor 240 150 40), clr4 = (defColor 100 100 100)
local font1 = (defFont "Swis721 Cn BT" 12), font2 = (defFont "Swis721 Cn BT" 10)
local GM = (dotNetClass "System.Drawing.Drawing2D.LinearGradientMode").Vertical
local BS = (dotNetClass "BorderStyle").None
fn defLabel dxLbl w h locX locY txt =
(
dxLbl.Location = defPoint locX locY ; dxLbl.AllowHtmlString = true ; dxLbl.Appearance.Font = font1
dxLbl.Appearance.BackColor = clr1 ; dxLbl.Appearance.BackColor2 = clr2 ; dxLbl.Size = defSize w h
dxLbl.Appearance.GradientMode = GM ; dxLbl.AutoSizeMode = dxLbl.AutoSizeMode.None ; dxLbl.Text = txt
dxLbl.Appearance.TextOptions.HAlignment = dxLbl.Appearance.TextOptions.HAlignment.Center
)
fn textboxDef dnTB w h locX locY txt =
(
dnTB.Width = w ; dnTB.Height = h ; dnTB.Location = defPoint locX locY
dnTB.Font = font1 ; dnTB.Text = txt ; dnTB.BackColor = clr3 ; dnTB.ForeColor = clr2 ; dnTB.BorderStyle = BS
dnTB.Multiline = dnTB.AutoSize = false ; dnTB.AcceptsReturn = true ; dnTB.TextAlign = dnTB.TextAlign.Center
dotnet.AddEventHandler dnTB "GotFocus" DisableAccel
dotnet.AddEventHandler dnTB "LostFocus" EnableAccel
)
fn defCheckbox dxCB w h locX locY =
(
dxCB.Location = defPoint locX locY ; dxCB.Size = defSize w h ; dxCB.Text = "A c t i v a t e | D e a c t i v a t e A u t o M o d e"
dxCB.BorderStyle = dxCB.BorderStyle.NoBorder ; dxCB.BackColor = clr2 ; dxCB.ForeColor = clr3 ; dxCB.Font = font2
)
fn randomChars str =
(
local rndCharStr = ""
for c in 1 to str.count do
(
local rndSize = ((random 12 16) as string), rndColor = (#((random 80 255),(random 80 255), (random 80 255)) as string)
append rndCharStr ("<size="+rndSize+"><color="+(substring rndColor 3 (rndColor.count-3))+">"+str[c]+"</color></size>")
) ; rndCharStr
)
fn randomNumbers str =
(
local rndNumStr = "", nums = "0123456789"
for c in 1 to str.count do
(
local charSize = "12", numSize = "14" ; rndColor = #((random 80 255),(random 80 255), (random 80 255)) as string
if (findstring nums str[c]) == undefined then (append rndNumStr ("<size="+charSize+"><color=240,150,40>"+str[c]+"</color></size>"))
else (append rndNumStr ("<size="+numSize+"><color=250,250,250>"+str[c]+"</color></size>"))
) ; rndNumStr
)
fn pressEnter s e =
(
if e.KeyCode == e.KeyCode.Return do
(
if s == tb1 then (lbl1.Text = randomChars s.Text)
else if s == tb2 do (lbl2.Text = randomNumbers s.Text)
)
)
fn cbCC s e = (if s.Checked == true then dnClock.Start() else dnClock.Stop())
fn clockTick s e =
(
lbl1.Text = (randomChars tb1.Text) ; tb2.Text = ("Local Time: "+localtime) ; lbl2.Text = (randomNumbers tb2.Text)
)
on RandomLetters open do
(
mxsPnl.Width = RandomLetters.width ; mxsPnl.Height = RandomLetters.height ; mxsPnl.backcolor = clr1
tb1 = dotNetObject "TextBox" ; textboxDef tb1 300 20 0 30 "Enter Your Text Here"
lbl1 = dotNetObject "DevExpress.XtraEditors.LabelControl" ; defLabel lbl1 300 30 0 0 (randomChars tb1.Text)
tb2 = dotNetObject "TextBox" ; textboxDef tb2 300 20 0 80 ("Local Time: "+localtime)
lbl2 = dotNetObject "DevExpress.XtraEditors.LabelControl" ; defLabel lbl2 300 30 0 50 (randomNumbers tb2.Text)
cb = dotNetObject "DevExpress.XtraEditors.CheckEdit" ; defCheckbox cb 300 20 0 100
dnClock = dotNetObject "Timer" ; dnClock.Interval = 1000
dotNet.AddEventHandler tb1 "KeyUp" pressEnter ; dotNet.AddEventHandler tb2 "KeyUp" pressEnter
dotNet.AddEventHandler cb "CheckedChanged" cbCC ; dotNet.addEventHandler dnClock "Tick" clockTick
mxsPnl.Controls.AddRange #(lbl1, tb1, lbl2, tb2, cb)
)
)
createDialog RandomLetters style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
)
:applause:
totally agree with your and Denis words… but all this stuff sometimes looks so cool :arteest:
it is a big temptation.
/EDIT
awesome example up there… crazy stuff)