| | |
Scrollable Album art (User control)
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2008
Posts: 6
Reputation:
Solved Threads: 0
Hi, I now have the back end of a music library application and I am now working on the GUI side.
I would like to display all the albums (Album cover art, Title and Artist) in a scrollable area, and would like some advice on how to do this:
Firstly is it a good idea to create a user control for each album? I knocked one together which is basically made up of a picture box (for the album art) and two labels underneath (for the title and artist). The plan was to place them on a panel and allow the user to scroll along them (in a grid view style). I got this working with a mock up using a button on the panel and got code working so you could "flick" the button left and right, but as soon as I added a large number of buttons (100) it became pretty much unusably slow! (I was using the Button1.Left property to move each button)
I'm pretty stuck on what to try/do next so any help/pointers would be greatly appreciated.
Cheers
I would like to display all the albums (Album cover art, Title and Artist) in a scrollable area, and would like some advice on how to do this:
Firstly is it a good idea to create a user control for each album? I knocked one together which is basically made up of a picture box (for the album art) and two labels underneath (for the title and artist). The plan was to place them on a panel and allow the user to scroll along them (in a grid view style). I got this working with a mock up using a button on the panel and got code working so you could "flick" the button left and right, but as soon as I added a large number of buttons (100) it became pretty much unusably slow! (I was using the Button1.Left property to move each button)
- Can someone suggest a better way of doing this?
- Is my custom control a good idea?
- Will I need to create a custom version of the Panel (or similar) to get a better "smooth" scroll?
- I assume for optimization I will only want to load the album art just before it comes into view, and unload it once it leaves view? (I currently have about 400 albums)
- Maybe I was just being unrealistic using 100 buttons as a test, as in the actual GUI I guess there will only ever be about 20-30 albums on the screen at once!
- Should I use a separate thread for loading the album arts?
I'm pretty stuck on what to try/do next so any help/pointers would be greatly appreciated.
Cheers
Last edited by thegrovesy; Apr 15th, 2009 at 10:33 am.
Your custom control seems to be a good idea to me.
I made something similar for the table of Mendeleev(chemical elements).
>Will I need to create a custom version of the Panel (or similar) to get a better "smooth" scroll?
There is already a custom version in the form of a FlowLayout panel.
Watch this video : http://msdn.microsoft.com/nl-be/vcsh...28(en-us).aspx
Sorry, with your other points I don't have that much experience.
I made something similar for the table of Mendeleev(chemical elements).
>Will I need to create a custom version of the Panel (or similar) to get a better "smooth" scroll?
There is already a custom version in the form of a FlowLayout panel.
Watch this video : http://msdn.microsoft.com/nl-be/vcsh...28(en-us).aspx
Sorry, with your other points I don't have that much experience.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
•
•
Join Date: May 2008
Posts: 6
Reputation:
Solved Threads: 0
Had a play with the FlowLayoutPanel last night and might do what I want. However I am having trouble getting it to scroll smoothly with the MouseMove event.
What I am doing is allowing the user to click/hold the panel then drag the mouse left/right to scroll along its contents. It also allows the user to Click/Hold/flick/release (if that makes sense) so that the contents is thrown and eventually slows down to a stop (iPhone style).
This same code worked well when I just had one button on a standard panel, but when I do it on this FlowLayoutPanel the dragging makes the contents very jittery!!! I have attached the test project for anyone wanting to see what I mean.
Also, I really want to remove the horizontal scrollbar, as the user will obviously be using the above method to scroll its contents.
Finally, I don't believe the problem is due to the number of controls I have added to the FlowLayoutPanel (400) as you can reduce this to a much smaller number (30) and the same problem happens.
Any ideas?
What I am doing is allowing the user to click/hold the panel then drag the mouse left/right to scroll along its contents. It also allows the user to Click/Hold/flick/release (if that makes sense) so that the contents is thrown and eventually slows down to a stop (iPhone style).
This same code worked well when I just had one button on a standard panel, but when I do it on this FlowLayoutPanel the dragging makes the contents very jittery!!! I have attached the test project for anyone wanting to see what I mean.
Also, I really want to remove the horizontal scrollbar, as the user will obviously be using the above method to scroll its contents.
Finally, I don't believe the problem is due to the number of controls I have added to the FlowLayoutPanel (400) as you can reduce this to a much smaller number (30) and the same problem happens.
Any ideas?
Once I made a clock control (pity I lost the code
)
My clock was also flickering.
I used double buffering as a remedy.
It might help with your problem.
This is to get you started: http://msdn.microsoft.com/en-us/library/ms229622.aspx
EDIT: btw could not open your zip file for some strange reason...
)My clock was also flickering.
I used double buffering as a remedy.
It might help with your problem.
This is to get you started: http://msdn.microsoft.com/en-us/library/ms229622.aspx
EDIT: btw could not open your zip file for some strange reason...
Last edited by ddanbe; Apr 16th, 2009 at 3:10 pm.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
![]() |
Other Threads in the C# Forum
- Previous Thread: C# Development Enviroment?
- Next Thread: send string from c# to c++
| Thread Tools | Search this Thread |
.net 2007 access activedirectory algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion cryptographyc#winformsencryption csharp custom database datagrid datagridview dataset date datetime degrees development disabled displayingopenforms draganddrop drawing encryption enum eventcloseformc# excel file foreach form format forms ftp function gdi+ image index index-error input install java label list listbox listener listview load mandelbrot math mathematics mouseclick mysql operator path photoshop picturebox pixelinversion post prime programming radians regex remoting richtextbox security server setup sleep socket sql statistics stream string table text textbox thread time timer totaldays update user usercontrol validation visual visualstudio webbrowser windows winforms wpf xml






