LineObject Class

Represents a line object drawn on the report. This class allows you to retrieve information and set generic format options inherited from the DrawingObject class.

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

Syntax

'Declaration
Public Class LineObject
    Inherits DrawingObject
    Implements IDisposable
public class LineObject : DrawingObject, IDisposable

Example

This example shows how to retrieve a ReportObject object by name through the Item property of the ReportObjects collection, and cast the ReportObject as a LineObject. It also shows how to update the properties of the line object.

'Declaration

      Private Function GetLineObject _
         (ByVal reportObjectName As String) As LineObject

         Dim line As LineObject

         If TypeOf _
            (Report.ReportDefinition.ReportObjects. _
            Item(reportObjectName)) Is LineObject Then
            line = _
               Report.ReportDefinition.ReportObjects. _
               Item(reportObjectName)
            GetLineObject = line
         Else : GetLineObject = Nothing
      End If

        Private Sub UpdateLineObjectProperties(ByVal myReportDocument As ReportDocument, ByVal lineObjectName As String, ByVal top As Integer, ByVal left As Integer)
          Dim myReportObject As ReportObject = myReportDocument.ReportDefinition.ReportObjects.Item(lineObjectName)
          If Not myReportObject Is Nothing And myReportObject.Kind = ReportObjectKind.LineObject Then
            Dim myLineObject As LineObject = myReportObject
            myLineObject.Top = top
            myLineObject.Left = left
            myLineObject.EnableExtendToBottomOfSection = True

            myLineObject.LineColor = Color.Red
            myLineObject.LineStyle = LineStyle.SingleLine
            myLineObject.LineThickness = 5

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

            Dim myObjectFormat As ObjectFormat = myLineObject.ObjectFormat
            myObjectFormat.EnableCanGrow = False
            myObjectFormat.EnableSuppress = False
            myObjectFormat.EnableCloseAtPageBreak = True
            myObjectFormat.EnableKeepTogether = True
          End If
      End Sub
      
      private LineObject GetLineObject(string reportObjectName)
      {
         LineObject line;

         line = Report.ReportDefinition.ReportObjects[reportObjectName]
            as LineObject;
         return line;
      }

            private void UpdateLineObjectProperties(ReportDocument reportDocument, String lineObjectName, int top, int left, int height, int width)
            {
              ReportObject reportObject = reportDocument.ReportDefinition.ReportObjects[lineObjectName];
              if (reportObject != null && reportObject.Kind == ReportObjectKind.LineObject)
              {
                LineObject lineObject = (LineObject)reportObject;
                lineObject.Top = top;
                lineObject.Left = left;
                lineObject.EnableExtendToBottomOfSection = true;

                lineObject.LineColor = Color.Red;
                lineObject.LineStyle = LineStyle.SingleLine;
                lineObject.LineThickness = 5;

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

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

Inheritance Hierarchy

Object
   EngineObjectBase
      ReportObject
         DrawingObject
            LineObject

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

LineObject Members
CrystalDecisions.CrystalReports.Engine Namespace