How to Draw Line using VB6 code

keturpatelketurpatel India
edited 6:36PM 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:36PM
    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:36PM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.