Page 1 of 1

StretchDraw and canvas background...

Posted: Mon Mar 12, 2007 2:10 pm
by 9523817
Hi!
I'm writing here for another problem.... I would like to draw a wmf file on the background of the tchart.

I've used this code:

Private Sub TChart1_OnAfterDraw()
With TChart1.Canvas
Dim stPic As StdPicture
Set stPic = LoadPicture("C:\door.wmf")

.StretchDraw 0, 0, 100, 100, stPic
End With
End Sub


But it hangs with error "run-time -2147418113 (8000ffff) Picture not valid" on .StretchDraw

I'm quite sure that the picture is valid, becouse If i run the editor, I could use it in "Panel / background / Backimage", and even if I use it on code:
With TChart1.Panel
.BackImageInside = False
.BackImageLoad ("C:\door.wmf")
End With

I've tried with .canvas becouse with .panel, in editor I can set left and top (even only until 100), but I haven't found the same settings in code properties!
My real problem is that I want align the image in the top-right corner... and the align methods (.BackImageMode) doesn't allow this (ehm.. do you know that .BackImageMode = 3 align the picture in top-left position? event it is not specified in the help and enum??)

Please could you give me a solution? (or how to make work the wmf in .stretchdraw or how to set top/left in BackImageLoad)
thanks a lot!!

Posted: Mon Mar 12, 2007 2:43 pm
by narcis
Hi BdMan,

Have you tried using a .emf metafile instead of .wmf?

...ops..

Posted: Mon Mar 12, 2007 3:32 pm
by 9523817
Thanks a lot, it seems to work! (with .emf)