New topic: Listbox Background?
<http://forums.realsoftware.com/viewtopic.php?t=46322> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message simulanics Post subject: Listbox Background?Posted: Sat Dec 22, 2012 8:00 pm Joined: Sun Aug 12, 2007 10:10 am Posts: 882 Location: Boiling Springs, SC Is there a 3rd party control or example of how to set an image to the listbox background or some Graphics 'hack'? The listbox is ugly...and would like to have a 'faded' image in the background..i could create a control..but I'm checking to see if there is something pre-existing before possibly re-inventing a wheel _________________ Matthew A. Combatti Real Studio 2012 r1.2 Visit Real Studio Developer's Spot! Systems I Use: 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: Listbox Background?Posted: Sat Dec 22, 2012 11:10 pm Joined: Thu Sep 10, 2009 2:50 am Posts: 322 Location: Santa Cruz, CA, USA Draw the pieces of the whole in CellBackgroundPaint. This sloppy code draws the appropriate region from the full lady_gaga picture that was dragged into the project. The image scrolls with the rows, Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean dim x0, y0, x1, y1 As integer y0 = row * me.RowHeight x0 = 0 for c As integer = 0 to column - 1 x0 = x0 + me.Column(c).WidthActual next x1 = me.Column(column).WidthActual y1 = g.Height if y0 > lady_gaga.Height then return false if x0 > lady_gaga.Width then return false g.DrawPicture lady_gaga, 0, 0, g.Width, g.Height, x0, y0, x1, y1 End Function For a statically placed image that the rows slide over is harder. The math change is simple: "y0 = (row - me.ScrollPosition) * me.RowHeight", but when the listbox scrolls it automatically moves the drawn image and only requests redrawing of the newly visible rows. This chops up the background. You need to repaint the entire field of cells. This gets me part way there... Function MouseWheel(X As Integer, Y As Integer, deltaX as Integer, deltaY as Integer) As Boolean me.InvalidateCell(-1, -1) End Function ..but scrolling by actually dragging the scrollbar, there's no event from which to issue invalidateCell. I don't know what to do about that. 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]
