Drawing a WebPicture or a Picture in a WebGraphics breaks the drawing system. Any workaround?

The long subject says almost all.
I’m drawing several objects in a WebCanvas. In trying to implement lockable objects, I now want to draw a padlock at locked objects.
I’ve found that using WebGraphics.DrawPicture is broken since August 2020 (a reproductible feedback case exists, with no solution provided).

I tried with several variations, combining these:
jpeg/png formats
Picture embedded in the project/loading from file
Using only Pictures/Only WebPictures/Mixing between them

All 8 possible combinations lead to the same result (everything is first drawn (except the picture) then a refresh automatically occurs and drawing is broken (a few lines randomly draw)).

I don’t want to waste time in drawing a padlock with built-in draw commands. Is there an alternative way to draw pictures?

Webcanvas can be finicky.

A possible workaround would be to draw on a picture graphics, and display it in an ImageViewer.

Thank you.
However, this solution doesn’t look ideal in my case. I’m not sure, but I think what is being done with the canvas currently would require a significant reworking to move to an ImageViewer.
With choosing between this reworking and using alternatives (just drawing an ✗, for example), the latter is easier (uglier, still).

But I get it. While this WebGraphics.DrawPicture bug isn’t fixed, a WebImageViewer probably works better, assuming you start with the idea to use the WebImageViewer from the beginning (which wasn’t the intuitive way in my case).

Would be nice to have drawing pictures capabilities in the WebCanvas, though…

Another way to go could be to stack WebCanvas on top of the WebImageViewer, the latter being reserved for pictures.

Also a good idea, thank you.

I’ve also found a third solution, which works for my case:

var fnm As String=g.FontName
var fns As Integer=g.FontSize

g.FontName=“Webdings”
g.FontSize=20
g.DrawText “”,pix,piy
g.FontName=fnm
g.FontSize=fns

The unprintable character, with the Webdings font, is a padlock.
I store and restore the FontName and FontSize because the WebGraphics Save and Restore methods seem to work only once.

Indeed, dingbat fonts is a great resource.

Webdings and Wingdings are great, but the richest one is Segoe UI Symbol. Hundreds of great icons.

1 Like

Good to know, thank you. I’ll take a look, out of curiosity.