http://www.dbi-tech.com/DeveloperBulletins/October09.htm

     
 

News Bulletin October 2009

 

Tech Tip – Oct 2009 - Custom images in the new dbiTips control

 

One of the more powerful features of the dbiTip control is the ability to create and display a dbiTipsObject. This object encapsulates the several areas of a dbiTip including the header, footer and body areas including images…

 

 

       'We are making a tip for a timebar, so I have a function that returns a dbiTipsObject

   Me.dbiTipsMain.ImageOnly = False

   Dim curTip As Dbi.WinControl.Tips.dbiTipsObject = MakeTipForTimeBar(e.TimeBarItem)

   Me.dbiTipsMain.Show(curTip)

 

                And the function to make a dynamic tip…

 

        Private Function MakeTipForTimeBar(ByRef curTimeBar As Dbi.WinControl.Schedule.dbiTimeBarItem) As Dbi.WinControl.Tips.dbiTipsObject

            'Declare a new dbiTipsObject

            Dim newTip As New Dbi.WinControl.Tips.dbiTipsObject

 

            'Set the default properties of the dbiTipsObject

            newTip.FillType = Dbi.enumFillType.Vertical

            newTip.HeaderVisible = True

            newTip.FooterVisible = True

            newTip.HeaderImage = My.Resources.TimeBarForTip 'Pull an image from the resources file for the header.

            newTip.HeaderFont = New Font("Trebuchet MS", 12, FontStyle.Bold, GraphicsUnit.Pixel)

            newTip.HeaderText = curTimeBar.Text

            newTip.HeaderForeColor = Color.DarkBlue

 

            Dim footerImage As Image

 

            Dim curShipment As dbiWSF.FrameworkObjects.objShipment = curTimeBar.Tag

 

            If curShipment.BreakoutDockQty <= 0 Then

                'If there are no breakout docks needed then tip is blue

                newTip.BackColor = Color.White

                'Make a blue fade effect for non-breakout dock tips.

                newTip.BackColorTo = Color.FromArgb(228, 239, 239)

            Else

                'If there are breakout docks then tip is red

                newTip.BackColor = Color.White

                'Make a red fade effect for breakout dock tips.

                newTip.BackColorTo = Color.FromArgb(255, 209, 208)

            End If

 

 

            If curShipment.GetCargoTypes.Count > 0 Then

                'Generates an image from internal code, strictly a drawing routine.

                footerImage = MakeImageFromCargoTypes(curShipment.GetCargoTypes)

                newTip.FooterImage = footerImage

                newTip.FooterText = "Cargo Types in Shipment"

                newTip.FooterFont = New Font("Trebuchet MS", 12, FontStyle.Italic + FontStyle.Bold, GraphicsUnit.Pixel)

                newTip.FooterForeColor = Color.DarkBlue

                Me.dbiTipsMain.FooterLine = True

            Else

                newTip.FooterVisible = False

                Me.dbiTipsMain.FooterLine = False

            End If

 

            Dim bodyString As String

            bodyString = "Start: " + curTimeBar.Start.ToString _

            + vbCrLf + "End: " + curTimeBar.End.ToString + vbCrLf

 

            If curShipment.BreakoutDockQty > 0 Then

                bodyString += vbCrLf + "**Breakout docks required: " + curShipment.BreakoutDockQty.ToString + vbCrLf

            End If

 

            bodyString += vbCrLf

 

            If curShipment.OrderHeaders.Count > 0 Then

                bodyString += "Orders on this shipment:" + vbCrLf

            Else

                bodyString += "There are no orders on this shipment." + vbCrLf

            End If

 

            For Each curOrderHeader As dbiWSF.FrameworkObjects.objOrderHeader In curShipment.OrderHeaders

                bodyString += curOrderHeader.OrderEntryType + ": " + curOrderHeader.OrderEntryID + vbCrLf

            Next

 

            newTip.BodyFont = New Font("Trebuchet MS", 12, FontStyle.Regular, GraphicsUnit.Pixel)

            newTip.BodyText = bodyString

            newTip.BodyForeColor = Color.Black

 

            Return newTip

 

        End Function

 

From that function we get several tips, some with footers, some without and there are multi-color indicators…

 
   
Breakout docks and footer for cargo types No breakout docks with cargo types
     
   
  Breakout docks with no cargo types (no footer)  
     
 
www.dbi-tech.com  | www.extractor.com  | www.staff-scheduler.com  | DBI Sales 
800.670.8045 | 204.985.5770
 
  all rights reserved  |  copyright  © 1996 to 2009  |  Terms of Use