Hi Folks...
I have a control that I'd like to have change a displayed image (for another). Looking at the methods currently available in VoltageImage, I spotted SetCurrentImage, and thought that would make a neater solution than creating a stack of hidden images and toggling their visibility.
I've added the images as extra resources, but unfortunately, SetCurrentImage doesn't seem to trigger a re-draw of the image object, so the displayed image isn't updated until something else (tool tip overlap, mouse click etc.) triggers the refresh.
Toggling the image visibility (from visible to invisible and back to visible) does update the display, but seems awkward.
Is there a better way of forcing an image redraw in this sort of situation and/or am I expecting the wrong things from SetCurrentImage?
Cheers,
--
Terry McG
VoltageImage SetCurrentImage behaviour
Re: VoltageImage SetCurrentImage behaviour
Hi,
if you don't have to change images from new sources, there's another way may be possible: define several images, with SetVisible() you can turn single images on and off.
if you don't have to change images from new sources, there's another way may be possible: define several images, with SetVisible() you can turn single images on and off.
- honki-bobo
- Posts: 306
- Joined: Sat Nov 09, 2019 1:18 pm
Re: VoltageImage SetCurrentImage behaviour
You can draw an image into the Graphics2D object of a VoltageCanvas. That way you don't need any SetVisible() magic and simply draw the image you want to have visible.
Re: VoltageImage SetCurrentImage behaviour
Thanks for the suggestions!
I'm familiar with the hide-n-seek method, but was hoping to avoid it.
Drawing the image to a Canvas is a new idea (to me anyway), but for the moment I'll live with toggling the image object's visibility (to force a refresh).
These are UI-rate events, so it shouldn't add too much load.
Cheers,
--
Terry McG
I'm familiar with the hide-n-seek method, but was hoping to avoid it.
Drawing the image to a Canvas is a new idea (to me anyway), but for the moment I'll live with toggling the image object's visibility (to force a refresh).
These are UI-rate events, so it shouldn't add too much load.
Cheers,
--
Terry McG