How to Draw Line using VB6 code

keturpatelketurpatel India
edited 6:12PM in FastReport Studio
Dear All,

I want to create a dynamic report as per given parameters at runtime. For this, i need to create a Horizontal line at specified point, but do not know how to do this.

To draw line in design mode, we have TfrxLineView object, which i cannot find at runtime. I tried TfrxFrame but did not able to do what i want.

I was able to draw a rectancle of height 0 using TfrxShapeView, which looks like a line. But again i will prefer to use TfrxLineView.

Any kind of help regarding issue is appreciated.

Thanks in advance,

Comments

  • edited 6:12PM
    Use following code
    Dim WithEvents report As TfrxReport
    Dim Page As IfrxReportPage
    Dim line1 As IfrxLineView
    
    ...
    ...
    
    Public Sub SetLine(component As IfrxComponent, left As Integer, top As Integer, width As Integer)
    component.left = left
    component.top = top
    component.width = width
    End Sub
    
    ...
    ...
    
    Set report = CreateObject("FastReport.TfrxReport")
    report.ClearReport
    Set Page = report.CreateReportObjectEx(report, "TfrxPage", "report_page")
    Page.TopMargin = 10
    Page.BottomMargin = 10
    Page.LeftMargin = 10
    Page.RightMargin = 10
    Page.PaperHeight = 297
    Page.PaperWidth = 210
    Set line1 = report.CreateReportObjectEx(Page, "TfrxLineView", "line1")
    SetLine line1, 32, 32, 640
    
  • keturpatelketurpatel India
    edited 6:12PM
    Thanks very much for reply to OlegK.

    At first glance, it seems to be a perfect solution.

    Will try it.

    Thanks again.

    KETUR

Leave a Comment