New topic: Draw with mouse on canvas
<http://forums.realsoftware.com/viewtopic.php?t=43782> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message simulanics Post subject: Draw with mouse on canvasPosted: Fri Apr 27, 2012 12:18 am Joined: Sun Aug 12, 2007 10:10 am Posts: 422 Location: Boiling Springs, SC How would one draw on a canvas using the mouse? _________________ Matthew A. Combatti Real Studio 2011 r4.3 Professional Edition Visit Real Studio Developer's Spot! Systems: Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8 Beta Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/ Windows Server 2011/CentOS 5.4 /ReactOS/SimOS ~All REAL Compatible~ Top doofus Post subject: Re: Draw with mouse on canvasPosted: Fri Apr 27, 2012 12:39 am Joined: Thu Sep 10, 2009 2:50 am Posts: 238 Location: Santa Cruz, CA, USA Ultra-minimal. Draw to a picture with the mousing events and draw that picture in paint Code://window properties... backPic As Picture oldX As integer oldY As integer //Canvas1 events... Sub Open() backPic = new Picture(me.Width, me.Height, 32) End Sub Sub Paint(g As Graphics) g.DrawPicture backPic, 0, 0 End Sub Function MouseDown(X As Integer, Y As Integer) As Boolean oldX = X oldY = Y return true End Function Sub MouseDrag(X As Integer, Y As Integer) backPic.Graphics.DrawLine oldX, oldY, X, Y me.Refresh oldX = X oldY = Y End Sub left out any coloring but the picture should start out all white and the graphics forecolor is black. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
