Add Graphics.Draw____Icon ScaleSize

Hi everyone,

for a custom Canvas Control I wrote I would like to draw sometimes one of the three Xojo supported system icons:

Graphics.DrawCautionIcon(X as Integer, Y as Integer) Graphics.DrawNoteIcon(X as Integer, Y as Integer) Graphics.DrawStopIcon(X as Integer, Y as Integer)

The icons should be drawn in a certain size. That’s impossible, because the three methods above haven’t any parameters to scale the icons like the Graphics.DrawPicture Methods. I created a Feedback-Case: <https://xojo.com/issue/49459>

Has anyone a solution to this until the developers will hopefully integrate this into Xojo?

They should already be at the correct size.

PS - Please don’t put feedback URLs into a URL tag. Just paste them in as-is and the forum will handle that.

in your case, you say:

My recollection is that it’s the OS that wants them drawn at a particular size, although that could be out-of-date because I don’t think I’ve seen anyone use those methods in a few years.

Can you give an example as to why you’d want them drawn at a different size?

You can eventually, get these icons as images, import them in your project and draw them at your size where you want ?

Not much work.

I made a subclass of TextInputCanvas and wanna validate the text after typing. If the text is wrong, I would like to show the native Stop Icon (macOS, Win, Linux). On my MacBook Pro Retina, the DrawStopIcon Methods draws the Icon large. But if my control is e.g. sized to an Height of 22 Pixels, that’s to large. I don’t wanna use external pictures.

You could resize it yourself:

dim p as new Picture(32,32) p.graphics.DrawStopIcon(0,0) g.DrawPicture p,0,0,22,22,0,0,32,32

[quote=349082:@Greg O’Lone]You could resize it yourself:

dim p as new Picture(32,32) p.graphics.DrawStopIcon(0,0) g.DrawPicture p,0,0,22,22,0,0,32,32[/quote]

Ok, thanks. And the Icon-Size is 32x32 Pixels for each OS? Whats with HiDPI Mode? Should I use

Dim p As Picture = Self.TrueWindow.BitmapForCaching(32, 32)

?

Don’t know off the top of my head. You’ll have to experiment.