Problem with Depreciation of Canvas Graphics for X 2018 R3

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.

[code]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[/code]

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

This really screwed things up.

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

[quote=436402:@James Redway]
This really screwed things up.[/quote]

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

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

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 Gale]
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.

[quote=436408:@James Redway]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)

[/quote]

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

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.