Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > Is it possible to use the PhotoListView outside of this application?
 

Is it possible to use the PhotoListView outside of this application?

I'd like to be able to use the PhotoListView in another application, but so far I haven't had much luck in trying to decouple it from FotoVision. I don't know if it's an artifact of VB.Net or just the way the application was architected, but the best way to describe the relationship between PhotoListView and the rest of the application is high coupling and low cohesion.

Right now it appears that the PhotoListView was never intended to be reusable outside FotoVision.

Colin
MigrationUser 1  Friday, August 06, 2004 4:46 PM
We thought about creating a base owner-draw ListView class and then a derived FotoVision thumbnail class, but that became a lower priority and did not happen. The basic idea with the PhotoListView class is:

- Hide the owner-draw details in the 'owner draw code' region. You should not have to modify this code.

- Drag and drop details are in the 'drag and drop methods' region. This uses a DropData class and you can remove this code or change for your application.

- The SetThumbnails method populates the list, it uses the Tag property to store a reference to a Photo object. You can delete this method or implement the list storage in some other way.

- The DrawItem method is the main drawing routine. It draws the item specified by the index argument. It gets the Photo object stored in the Tag property. You would do your own drawing here.

If I have time next week, I'll look into using the class in another application.
--
ralph arvesen
MigrationUser 1  Saturday, August 07, 2004 8:53 AM
I went ahead and created a sample app that uses the PhotoListView control. It took 5 minutes to reuse the PhotoListView control in another application. You could extend it further by making a base class. I don't know how to post files to the forum, please email me and I'll send you the sample. Thanks,
--
ralph arvesen
email: see www.lostsprings.com
MigrationUser 1  Saturday, August 07, 2004 10:46 AM
I was really tired when I posted the first question and should have explained it better. I figured it would probably be easy to use the control in a different application. I'm trying to unravel all the dependencies and strip down the code to the bare essentials. I don't want to distribute the entire fotovision application with my app.

I think your comments will save me some time in figuring out how to use the control. I don't do VB.Net so it's taking me much longer than usual to understand the code.

Thanks.

Colin
MigrationUser 1  Saturday, August 07, 2004 9:14 PM
I created a sample app that shows how to use the <b>PhotoListView</b> class in another application. The sample contains a base class called <b>OwnerDrawnListView</b> that exposes the property <b>CellSize</b> and calls the virtual method <b>DrawItem</b> when a cell should be drawn. The class <b>SampleListView</b> derives from OwnerDrawnListView and overrides the DrawItem method.

Please let me know if this helps or if you notice any problems, have any questions, etc. The links are:

<a href="http://www.lostsprings.com/samples/FotoVision%20ListView%20Sample.zip">Download sample (zip file)</a>

<a href="http://www.lostsprings.com/samples/FotoVision%20ListView%20Sample.png">Sample screenshot (png file)</a>

--
ralph arvesen


MigrationUser 1  Monday, August 09, 2004 2:20 PM

I know it has been awhile since this was posted.  I use the PhotoListView in an application, and am looking at upgrading to VS2005, but noticed there is a problem.  Images no longer remain visible in the list.  It you click on the image it will display, but once you click somewhere else it dissappears (the label is still there, however).

I tried this with your OwnerDrawnListView and had the same issue with VS2005.

Any ideas?  (Some of this is still over my head technically!)

 

Thanks,

Tom Shalloe

 

 

Tom Shalloe  Thursday, January 12, 2006 7:03 PM

You can use google to search for other answers

Custom Search

More Threads

• Occupied Space and cellRadius
• What is the data member when using a stored procedure?
• i am wondering...
• why?
• The parameter is incorrect - Task Vision Server
• Terrarium Server - Strange periodic message in EventLog
• not able to download xml files
• Random Tip
• Work Items
• Using rich text box for Text Editor