Problem with Depreciation of Canvas Graphics for X 2018 R3

  1. 2 months ago

    James R

    May 14 Pre-Release Testers, Xojo Pro Connecticut
    Edited 2 months ago

    With the depreciation of the Canvas Graphics you can no longer use graphics in the lines of code. When I run my app now I get 3568 error messages. I created my own buttons using a Canvas. The image changes depending on which event you are using, such as MouseUp, MouseOver, Mouse Exit, etc...

    Much of my code looks like this.

    Dim p As Picture = New Picture(Me.Graphics.Width, Me.Graphics.Height, 32)
    p.transparent = 1
    p.Graphics.DrawPicture(C, 0, 0, Me.Graphics.Width,Me.Graphics.Height, 0, 0, C.Width, C.Height)
    
    me.backdrop = p

    Is the a way I can fix this that does not entail starting over?

    This really screwed things up.

  2. Kevin G

    May 14 Pre-Release Testers, Xojo Pro Gatesheed, England

    How about
    Me.Width / Me.Height rather than Me.Graphics.Width / Me.Graphics.Height

  3. Ivan T

    May 14 Pre-Release Testers

    @James R This really screwed things up.

    The documentation stated for years NOT to do things that way. Are you redrawing all the picture each time?

    @James R Is the a way I can fix this that does not entail starting over?

    Stick with previous Versions.

    Or, do all the drawing in the paint event. Use a variable for the status and call Invalidate in your events. Also, use some cache for performance

  4. James R

    May 14 Pre-Release Testers, Xojo Pro Connecticut

    Hi Kevin,

    Thank you for taking the time to try to help me. That got rid of about 3100 of the error.

    Now I just get the error on this code:

    p.DrawPicture(C6, 0, 0, Canvas6.Width,Canvas6.Height, 0, 0, C6.Width, C6.Height)

    frmBlue.ResetButtons, line 253
    Type "Picture" has no member named "DrawPicture"
    p.DrawPicture(PML, 0, 0, bPMailList.Width, bPMailList.Height, 0, 0, PML.Width, PML.Height)

    [quote=436404:@Kevin G]
    The documentation stated for years NOT to do things that way. Are you redrawing all the picture each time?

    The documentation is hundreds of pages long. I have not read the entire documentation. If I read that, I certainly would not have done it that way.

  5. Karen A

    May 14 Pre-Release Testers
    Edited 2 months ago

    @James R Hi Kevin,

    Thank you for taking the time to try to help me. That got rid of about 3100 of the error.

    Now I just get the error on this code:

    p.DrawPicture(C6, 0, 0, Canvas6.Width,Canvas6.Height, 0, 0, C6.Width, C6.Height)

    That SHOULD be

    p.Graphics.DrawPicture(C6, 0, 0, Canvas6.Width,Canvas6.Height, 0, 0, C6.Width, C6.Height)

    Graphics for pictures is fine.

    - karen

  6. Emile S

    May 15 Europe (France, Strasbourg)

    @James R The documentation is hundreds of pages long. I have not read the entire documentation. If I read that, I certainly would not have done it that way

    The documentation for Canvas ?
    The Release Notes ?

    Did you clicked in the Check this Item for errors button (of the IDE) recently ?

    I am quite sure that you do not regularly read this forum (else, you would ahve read about the same questions since last november or so).

    Your question above is the result of not getting “up-to-date” in the documentation all these years.

    This is not a rant.

or Sign Up to reply!