[Closed] DotNet Progressbar
Does anyone have a way of creating a progressbar using dotNet that looks more like a standard Max progressbar? I can’t seem to get it to look like anything other than a standard Windows bar with chunky green blocks. Since it’s tied to the visual style settings on the user’s computer, I can’t change the background or foreground color, or the style parameter.
Just to be clear, the functionality is great, it’s just the look I can’t stand.
draw a rectangle, adjust its size based on the progress you want?
P.S. What does this draw like on your screen?
rollout roll_test "test" width:400 height:100 (
dotNetControl dno_pb "Windows.Forms.Progressbar" width:300 height:20
timer tick_tock interval:100 active:true
on roll_test open do (
dno_pb.style = dno_pb.style.continuous
dno_pb.backColor = (dotNetClass "System.Drawing.Color").darkgreen
dno_pb.foreColor = (dotNetClass "System.Drawing.Color").limegreen
)
on tick_tock tick do (
dno_pb.value = mod tick_tock.ticks 100.0
)
)
CreateDialog roll_test
I thought about the box solution too. But the having the ability to set the step size and then just call PerformStep() on each iteration through a loop is very nice.
As far as your sample goes…
No matter what I set the back or fore colors to, or the style, the appearance doesn’t change.
well, you could easily abstract that to a function of your own, of course
as for the style… d’oh; doesn’t look like I have the Silver theme installed (anymore) and the Candy one seems to be fine. Either way, it looks like you’d have to disable visual styles for the app. Have a google around – it’d require some C#/VB.NET code (which you can compile on-the-fly – have a search through the forums here) and it looks like changing it would apply to any windows created after the call. Ouch.
So uhm, rectangle?
there’s this one that I like very much … if your don’t mind loading the big devexpress assembly
try (NewForm1.close()) catch ()
(
dotNet.loadAssembly (getdir #maxroot +"MaxCustomControls.dll")
dotnet.loadAssembly (getdir #maxroot + "\\DevExpress.XtraEditors.v7.1.dll")
Global NewForm1 = (dotnetobject "maxcustomcontrols.maxform")
local NewPbar = (dotnetobject "DevExpress.XtraEditors.ProgressBar")
--//-- Main Function
fn NewForm1_closed s e =
(
NewForm1 = undefined
(dotnetclass "system.gc").collect()
gc()
)
--//--
--//-- NewPbar --//--
--//--
NewPbar.name = "NewPbar"
NewPbar.BorderStyle = NewPbar.BorderStyle.Style3D
NewPbar.Dock = NewPbar.Dock.Bottom
NewPbar.properties.showtitle=true
NewPbar.properties.lookandfeel.skinname="Money Twins"
NewPbar.properties.lookandfeel.usedefaultlookandfeel=false
NewPbar.properties.lookandfeel.usewindowsxptheme=false
NewPbar.properties.lookandfeel.style=NewPbar.properties.lookandfeel.style.skin
--//--
--//-- NewForm1 --//-- (Designer look for this line, Please DO NOT REMOVE)
--//--
NewForm1.name = "NewForm1"
NewForm1.startposition = NewForm1.startposition.centerscreen
NewForm1.formborderstyle = NewForm1.formborderstyle.sizable
NewForm1.backcolor = NewForm1.backcolor.fromargb 255 220 220 220
NewForm1.forecolor = NewForm1.forecolor.fromargb 255 0 0 0
NewForm1.size = dotnetobject "system.drawing.size" 400 280
NewForm1.text = "NewForm1"
NewForm1.ShowIcon = true
NewForm1.showintaskbar = false
NewForm1.topmost = false
dotnet.addeventhandler NewForm1 "closed" NewForm1_closed
--//--
NewForm1.controls.add NewPbar
--//--
NewForm1.controls.item[0].PerformStep()
NewForm1.controls.item[0].PerformStep()
NewForm1.controls.item[0].PerformStep()
--NewForm1.controls.item[0].ResetText()
--//--
NewForm1.ShowModeless()
)
Best regard,
martin
Hi James,
I’m in the same pickle about the XP themed scrollbars, they look like cr*p and dont bed very well with the max interface. Have you had a quick search on codeproject?, sounds like the sort of thing someone might have already done.
Other than that, I have used the paint event to draw a line over a control in the past, and a label control to make a flat progressbar, but I realise not helpful if you like the existing functionality.
oups, you wanted flat style …this one look more flat + you can have gradient if you wish
try (NewForm1.close()) catch ()
(
dotNet.loadAssembly (getdir #maxroot +"\\MaxCustomControls.dll")
dotnet.loadAssembly (getdir #maxroot + "\\DevExpress.XtraEditors.v7.1.dll")
--//--
Global NewForm1 = (dotnetobject "maxcustomcontrols.maxform")
local NewPbar = (dotnetobject "DevExpress.XtraEditors.ProgressBar")
--//-- Main Function
fn NewForm1_closed s e =
(
NewForm1 = undefined
(dotnetclass "system.gc").collect()
gc()
)
--//--
--//-- NewPbar --//--
--//--
NewPbar.name = "NewPbar"
NewPbar.BorderStyle = NewPbar.BorderStyle.flat
NewPbar.Dock = NewPbar.Dock.Bottom
NewPbar.properties.showtitle=true
NewPbar.properties.startcolor=NewPbar.properties.startcolor.black
NewPbar.properties.endcolor=NewPbar.properties.startcolor.white
NewPbar.properties.lookandfeel.style=NewPbar.properties.lookandfeel.style.Flat
NewPbar.properties.progressviewstyle=NewPbar.properties.progressviewstyle.Solid --broken
NewPbar.properties.lookandfeel.usedefaultlookandfeel=false
NewPbar.properties.lookandfeel.usewindowsxptheme=false
--//--
--//-- NewForm1 --//--
--//--
NewForm1.name = "NewForm1"
NewForm1.startposition = NewForm1.startposition.centerscreen
NewForm1.formborderstyle = NewForm1.formborderstyle.sizable
NewForm1.backcolor = NewForm1.backcolor.fromargb 255 220 220 220
NewForm1.forecolor = NewForm1.forecolor.fromargb 255 0 0 0
NewForm1.size = dotnetobject "system.drawing.size" 400 280
NewForm1.text = "NewForm1"
NewForm1.ShowIcon = true
NewForm1.showintaskbar = false
NewForm1.topmost = false
dotnet.addeventhandler NewForm1 "closed" NewForm1_closed
--//--
NewForm1.controls.add NewPbar
--//--
for f in 1 to 7 do
(
NewForm1.controls.item[0].PerformStep()
)
--NewForm1.controls.item[0].ResetText()
--//--
NewForm1.ShowModeless()
)
ProgressODoom looks like the ultimate in obsessive flexibility … but I think there might be a fair amount of faffing, exposing enumerations, etc, to MXS. It’s done right, though, based on decorators.