Page 1 of 1

Canvas disappears

Posted: Wed Sep 05, 2007 7:20 pm
by 6919638
Sirs,

I drew a legend in the graph when I clicked in one point.
I'm using canvas, but when I changed the focus to another form, my legend disappear.

Or when I scroll the graph the legend disappear too.

Can You help me?

Igor

Posted: Thu Sep 06, 2007 8:32 am
by narcis
Hi Igor,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Canvas disappears

Posted: Thu Sep 06, 2007 5:55 pm
by 6919638
NarcĂ­s,

I drew a Line diagonally from top left to bottom right, using the code above:
With TChart1
.Canvas.MoveTo .Axis.Left.Position, .Axis.Top.Position
.Canvas.LineTo .Axis.Right.Position, .Axis.Bottom.Position
End With

But when I scrolled the graph, the line disappears.

Can you help me fixed this?

Thanks,

Posted: Fri Sep 07, 2007 8:15 am
by narcis
Hi Igor,

You need to use this code in the OnAfterDraw event:

Code: Select all

Private Sub TChart1_OnAfterDraw()
    With TChart1
        .Canvas.MoveTo .Axis.Left.Position, .Axis.Top.Position
        .Canvas.LineTo .Axis.Right.Position, .Axis.Bottom.Position
    End With
End Sub