Re: Deprecated "Graphics" dropped
pidog <[email protected]> Sat, 22 Dec 2018 19:59:57 +0000 (UTC)
| Newsgroups | gmane.comp.lang.realbasic.user |
|---|---|
| Message-ID | <[email protected]> |
------------=_1545508797-19827-1168 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable If you need an easy way to allow your current code to still work, you can u= se canvas.backdrop as a stand-in for the old canvas.graphics Add a module to your project and add a global method: Public Function graphics(extends c As Canvas) as Graphics If c.Backdrop=3DNil Then c.Backdrop=3DNew Picture(c.Width,c.Height) c.Invalidate Return c.Backdrop.Graphics End Function This works in 2018r4 but I wouldn't guarantee it in the future. You can also add checks for the width and height matching and maybe create = a new picture and draw the current one into it and then swap the new one in= if the size changes but I just wanted to give you a simple solution. Should at least get you going until you can get away from the old way of do= ing it. -Jim= ------------=_1545508797-19827-1168 Content-Type: text/html; charset="us-ascii" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable <html><body> <p>If you need an easy way to allow your current code to still work, you ca= n use canvas.backdrop as a stand-in for the old canvas.graphics</p> <p>Add a module to your project and add a global method:</p> <p>Public Function graphics(extends c As Canvas) as Graphics</p> <pre>If c.Backdrop=3DNil Then c.Backdrop=3DNew Picture(c.Width,c.Height) c.Invalidate Return c.Backdrop.Graphics</pre> <p>End Function</p> <p>This works in 2018r4 but I wouldn't guarantee it in the future.</p> <p>You can also add checks for the width and height matching and maybe crea= te a new picture and draw the current one into it and then swap the new one= in if the size changes but I just wanted to give you a simple solution.</p> <p>Should at least get you going until you can get away from the old way of= doing it.</p> <p>-Jim</p> <img src=3D"https://u9098352.ct.sendgrid.net/wf/open?upn=3DW5IIOHYh8Ix-2Flm= NrgtTomW8ATk7pXvOSwl3ev5ZofJfrG1WcopwlQjR5MhBEx8oRtBy9WXr1ueYh0Yjw4h7UgSH4G= avT3KxSFnnK6aZ0YHRwwmEcRalf50-2Fk-2FwlW26oF-2FLLdKELwWAj5h0HKUtxwK-2Bvfkrgg= MaB8abxJpcjYs4j6rNqPsDyftEcQ-2Bju6QOnLKuWfpOUGzHHyDt3xe5dycQiD7o4RLORyvM2iQ= 2-2FM4rw-3D" alt=3D"" width=3D"1" height=3D"1" border=3D"0" style=3D"height= :1px !important;width:1px !important;border-width:0 !important;margin-top:0= !important;margin-bottom:0 !important;margin-right:0 !important;margin-lef= t:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding= -right:0 !important;padding-left:0 !important;"/> </body></html> ------------=_1545508797-19827-1168--