Page 1 of 1

Displaying a number on canvas

Posted: Mon Mar 01, 2004 3:21 pm
by 6920687
I need to display a number value that is passed as a variable on the canvas. I am know I can use “chart1.Canvas.TextOut” to display a text value but is it possible to pass a number and text value (ex. Avg = var1 var1 being a number variable).

Please help. An example will be greatly appreciated.

Thanks,

Ted

Posted: Mon Mar 01, 2004 3:37 pm
by Pep
Hi Ted,

you can do something like this :

Code: Select all

Dim value
Private Sub Form_Load()
    value = 10 + 10
End Sub

Private Sub TChart1_OnAfterDraw()
TChart1.Canvas.TextOut 40, 40, Str(value)
End Sub

Posted: Tue Mar 02, 2004 2:06 pm
by 6920687
Thanks for the quick response.
I tried your recommended solution but it is not displaying the number on the canvas.

On the chart I am working with there are two series one is a line and the other is horizline. And the code I user to write on the canvas is as follows:

staticTtt.Canvas.Font.Name = staticTtt.Footer.Font.Name
staticTtt.Canvas.Brush.Style = 0
staticTtt.Canvas.TextOut (staticTtt.Canvas.Left + _(staticTtt.Canvas.Width / 2)), (staticTtt.Canvas.Top + _(staticTtt.Canvas.Height / 2)), cstr(avgTtt)

avgTtt is a variable that is set and value assigned to it at an erlier stage of the code.

What am I missing?
Thanks again.

Ted

Posted: Wed Mar 03, 2004 4:17 pm
by Pep
Hi Ted,

strange, here works as expected. I've sent one example to the steema.public.attachments newsgroup, could you please check if it works fine for you ?