Share via


PictureObject Class

Represents a picture object on the report.

Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)

Syntax

'Declaration
Public Class PictureObject
    Inherits ReportObject
    Implements IDisposable
public class PictureObject : ReportObject, IDisposable

Remarks

This class allows you to retrieve information and set generic format options inherited from the GraphicObject class.

Example

This example shows how to retrieve a ReportObject object by index or by name through the Item Property of the ReportObjects collection, and cast the ReportObject as a PictureObject and how to update the picture object properties.

'Declaration

      Private Function GetPictureObject _
         (ByVal reportObjectName As String) As PictureObject

         Dim picture As PictureObject

         If TypeOf _
            (Report.ReportDefinition.ReportObjects. _
            Item(reportObjectName)) Is PictureObject Then
            picture = _
               Report.ReportDefinition.ReportObjects. _
               Item(reportObjectName)
            GetPictureObject = picture
         Else : GetPictureObject = Nothing
         End If
      End Function

            Private Sub UpdatePictureObjectProperties(ByVal myReportDocument As ReportDocument, ByVal pictureObjectName As String, ByVal top As Integer, ByVal left As Integer, ByVal height As Integer, ByVal width As Integer)
              Dim myReportObject As ReportObject = myReportDocument.ReportDefinition.ReportObjects.Item(pictureObjectName)
              If Not myReportObject Is Nothing And myReportObject.Kind = ReportObjectKind.LineObject Then
                Dim myPictureObject As PictureObject = myReportObject
                myPictureObject.Top = top
                myPictureObject.Left = left
                myPictureObject.Height = height
                myPictureObject.Width = width

                Dim myBorder As Border = myPictureObject.Border()
                myBorder.BackgroundColor = Color.White
                myBorder.BorderColor = Color.Red

                Dim myObjectFormat As ObjectFormat = myPictureObject.ObjectFormat
                myObjectFormat.EnableCanGrow = False
                myObjectFormat.EnableSuppress = False
                myObjectFormat.EnableCloseAtPageBreak = True
                myObjectFormat.EnableKeepTogether = True
              End If
      End Sub
      
      private PictureObject GetPictureObject
         (string reportObjectName)
      {
         PictureObject picture;

         picture =
            Report.ReportDefinition.ReportObjects[reportObjectName]
            as PictureObject;
         return picture;
      }

            private void UpdatePictureObjectProperties(ReportDocument reportDocument, String pictureObjectName, int top, int left, int height, int width)
            {
              ReportObject reportObject = reportDocument.ReportDefinition.ReportObjects[pictureObjectName];

              if (reportObject != null && reportObject is PictureObject)
              {
                PictureObject pictureObject = (PictureObject)reportObject;
                pictureObject.Top = top;
                pictureObject.Left = left;
                pictureObject.Height = height;
                pictureObject.Width = width;

                Border border = pictureObject.Border;
                border.BackgroundColor = Color.White;
                border.BorderColor = Color.Red;

                ObjectFormat objectFormat = pictureObject.ObjectFormat;
                objectFormat.EnableCanGrow = false;
                objectFormat.EnableSuppress = false;
                objectFormat.EnableCloseAtPageBreak = true;
                objectFormat.EnableKeepTogether = true;
              }
      }
      

Inheritance Hierarchy

Object
   EngineObjectBase
      ReportObject
         PictureObject

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

PictureObject Members
CrystalDecisions.CrystalReports.Engine Namespace