|
|
|
Greetings and salutations, today we are going to take a
quick peek at the TimeBar style and how we can use them to
achieve some unique looks including fade fills and stacked
TimeBars.
Each TimeBars can be assigned a special “style” that controls
how it looks. The styles themselves can modify the default
appearance of TimeBars tremendously. For example we can
apply fade effects, set the height and offset so we can
“stack” bars on top of each other, and we can apply
start/end images. While we have the nuts and bolts of how to
do this in our demo applications, sometimes they look more
intimidating than they really are. For example lets say I
want three unique time bar styles, I can declare 3 global
variables (modular or form level, whichever appeals to your
sense of programming)
Dim intBlueFadeStyle as integer
Dim intRedFadeStyle as integer
Dim intPeoplePicStyle as integer
Dim dbiTimeBarStyle as
Dbi.WinControl.Schedule.dbiTimeBarStyle
Now we can set up our timebar styles…
dbiTimeBarStyle = new
Dbi.WinControl.Schedule.dbiTimeBarStyle ‘ make a new style
dbiTimeBarStyle.StartImage
= -7 dbiTimeBarStyle.EndImage = -7 dbiTimeBarStyle.BarHeight
= 8 dbiTimeBarStyle.VerticalOffset = 10
dbiTimeBarStyle.BackColor = Color.Cyan
dbiTimeBarStyle.BackColorTo = Color.SteelBlue
dbiTimeBarStyle.FillType = Dbi.enumFillType.Horizontal
intBlueFadeStyle = me.DbiSchedule1.TimeBarStyles.Add (dbiTimeBarStyle)
dbiTimeBarStyle = Dbi.WinControl.Schedule.dbiTimeBarStyle ‘
make a new style dbiTimeBarStyle = New
Dbi.WinControl.Schedule.dbiTimeBarStyle
dbiTimeBarStyle.StartImage = -5
dbiTimeBarStyle.EndImage = -5
dbiTimeBarStyle.BarHeight = 8
dbiTimeBarStyle.VerticalOffset = -5
dbiTimeBarStyle.BackColor = Color.Red
dbiTimeBarStyle.BackColorTo = Color.White
intRedFadeStyle = me.DbiSchedule1.TimeBarStyles.Add (dbiTimeBarStyle)
dbiTimeBarStyle = New
Dbi.WinControl.Schedule.dbiTimeBarStyle ‘ make a new style
dbiTimeBarStyle.StartImage
= 0 dbiTimeBarStyle.EndImage = 1 dbiTimeBarStyle.BarHeight =
6
intPeoplePicStyle = me.DbiSchedule1.TimeBarStyles.Add (dbiTimeBarStyle)
‘So we now have some nice styles to play with, we can apply
them to timebars just by setting the timebar
style property.
Dim newTimebar as new Dbi.Wincontrol.Schedule.dbiTimeBarItem
newTimebar.start = now
newTimebar.end = newtimebar.start.adddays(2)
newTimebar.Style = intBlueFadeStyle
me.dbiSchedule1.Items(0).Timebars.Add (newTimebar)
And there we go, we can do all kinds of things with the
styles this way, including my favorite stackable
bars. I wrote a quick routine to scan through each item’s
timebars. If I found a conflict then I set the
first one to a style with a lower vertical offset, then the
next ones I can keep just iterating through. You
can be quite creative with your styles and really make
things pop with some good fills and images.
As always, take care and have a great day!
DBI Technical Support
support AT dbi-tech.com
|
|