Efficiently updating a string on a display

I’m currently displaying the time on a connected LCD. Every time I want to update the time, I use the FillRectangle() method to erase the previous time, and the DrawString() method to display the new time. I’m worried this approach will continuously layer and start using a lot of memory.

Is this a valid concern? If so, would I need to call Graphics.Clear() and reload the whole page every so often or is there a better way to remove a specific string/image from the display?

What device are you using?

Fillrect or Clear don’t use memory. They just reset the current buffer. On SITCore 480x272, we can get 100fps when redraw whole screen.

You can fillrect small area where the string is, or make small buffer, draw string on this buffer then flush this buffer to main buffer.

Thanks, that answers it! I’ll just continue with my method then.

I’m not quite sure of your exact setup here, but in the past I’ve done screen update optimization software.

Use two buffers one that reflects what’s currently on the screen and another buffer that represents what you want to appear next.

Then one runs an algorithm to determine the differences and from that generate a set of drawing commands that will change only what needs to be changed on the screen.

I used that on character mode screens years ago (40x80) on a stock trading system where prices were randomly updating in real-time.

From second to second the changes were tiny, like 12.457 changing to 12.356, we’d just position to the 4 and draw a 3 then position to the 7 and draw a 6.

This saved a huge amount of time when the minicomputer was driving a hundred terminals.

This might have some use for you, I can’t tell though !