4 Replies Latest reply on Apr 20, 2012 9:42 AM by ConditionMonitoring

    Inserting an Image to a pdi

    ConditionMonitoring

      I have a bitmap file that i would like to add to my display.but i am getting an error upon loading the image

       

      My current code is:

       

                  Dim oImage As PBSymLib.Bitmap
                  Dim oSymbol_Image As PBObjLib.Symbol

                  oImage = newwindow.Symbols.Add(PBObjLib.pbSYMBOLTYPE.pbSymbolBitmap)
                  oImage = oSymbol_Image

       

                  oImage .Load("filelocation") 

        • Re: Inserting an Image to a pdi
          Ahmad Fattahi

          Tom,

           

          Please see this thread and this one for examples on how to use a bitmap file in ProcessBook.

            • Re: Inserting an Image to a pdi
              ConditionMonitoring

              Thanks for the links but I am not trying to use a bitmap image on a toolbar button, just as a single image within my display, so i cannot utilise the LoadFace function which those links are saying to use.

               

              Should i use the the PBImage class instead of the Bitmap class?

                • Re: Inserting an Image to a pdi
                  mhamel

                  @Tom: You don`t need to use a PBObjLib.Symbol object directly. As you have a reference of a PBObjLib.Bitmap object, you can immediately start to interact with it.

                   

                  To have a smoother refresh of your bitmap, particularly if it is big or contains a lot of details, hide your symbol during the manipulation process and make it visible in your final step.

                   
                       'Objects.
                      Dim oImage As PBSymLib.Bitmap
                      Dim oSymbol_Image As PBObjLib.Symbol
                      
                       'What you need to load a bitmap-type file programmatically into a bitmap symbol.
                      oImage = ThisDisplay.Symbols.Add(PBObjLib.pbSYMBOLTYPE.pbSymbolBitmap)
                       
                       'Hide it during the manipulation.
                       oImage.Visible = False
                       
                       'Adjust the size of your bitmap
                       'oImage.Top = 
                       'oImage.Left = 
                       'oImage.Height = 
                       'oImage.Width = 
                       
                       'Set the scaling of your bitmap file if there is any.
                       oImage.ImageSizing = Bitmap.ImageSizing.pbImageSizingFixed
                       'or it can be pbImageSizingRetainAspectRatio or pbImageSizingStretch.
                       
                      'Load programmatically the file...
                       oImage.Load ("")
                       
                       'This part is needed if you need to handle it as a generic ProcessBook symbol.
                       oSymbol_Image = oImage
                       
                       'Make if visible for a final refresh.
                       oImage.Visible = True
                  

                   Let me know if that answered your question.