Canvas/Figure graphic grey after page open, calling same function after load gives correct result

Hi all,

so as the title says, I am having a really strange and annoying issue. I swear this worked normal just yesterday, but backups from the past couple days and builds have the same issue … Would appreciate any ideas on how I can troubleshoot this

I am using data plot classes to graph some data, on page load, I have a function LoadData() that plots all the points. I customized the Legend.Draw method to draw onto a second canvas. This second canvas now remains grey on page load, but if I switch a radiobutton that calls the same LoadData method or resize the screen (calling the refresh/draw method) on page open it works as expected … It only behaves strangely on the first load, doesn’t matter if I call the method twice, press the buttons, change window size …

is the drawing being controls via the PAINT event for the canvas? If not it should be…
Do not attempt to draw to, update or modify the contents of the Canvas from anywhere else

You can draw on a Picture object and then have the PAINT event for the canvas display that,

Is this a Desktop project or is it a Web project?

Thanks for the replies, while typing up a response and taking a closer look at what was going on, I realized I was using the custom figure class for my Legend when I just needed a canvas and it works as I want now …

Actually, it wasn’t just the figure as when I changed the original legend figure to a canvas and tried with that (first time was just a second canvas), it still didn’t work on load! For some reason, the issue was with setting the height and width of the canvas/figure in the Legend draw method. Strangely, both H and W are set and again, it works after load but not at first or if I call the function twice. Man, programming really confuses me sometimes …