views:

617

answers:

1

I have been working on a ImageRotator control and finished weeding out any oddities with it tonight, and it works great. However, there is one thing that is bugging me with it. It doesn't display anything at design time (I just get the image placeholder).

I have been Googling, and came across a good article from Rick Strahl (as always), and this works great for single images, where the path is explicit.

However, the ImageRotator will actually just take a path to a folder and scan that, and loop through those. Currently this doesnt work at design time because the image "pooling" doesn't work (I am thinking its because the designer doesn't give permission to the code to scan the filesystem).

So, can this be done? Would it be possible to implement a custom designer for the control and elevate permissions (or something) there?


Update Following Some Pondering While Sipping Tea (How Very British of Me!)

Would it be possible to create a Designer for the control, create an image, encode it to base64 and stick that in the code base and render it?

This way I wouldn't need to give a crap about the images in the pool because I would have my own ^_^

(Although grabbing and image from the pool would be nicer since, well, thats what the user has selected right?).

+1  A: 

Hey Rick Stranl also has a post here that describes detecting design time. If its in design time just give it a fixed image from the pool. For example, alays take the first one or osmething like that.

Matthew M. Osborn
Thanks for the link, however, this has the same problem, how do I know the first one? ;) I would be happy with one to display, but I cant get ANY of the file names! :)
Rob Cooper
Have a design time image that is a placeholder?
Matthew M. Osborn
Erm, come again? :) I would like an image, from the pool, rendered at design time, instead of the little image placeholder thing (the bitmap icon).
Rob Cooper
No, have the design time image be a compiled resource in the design time class. The only time you should see actual working data in the control is when it's being used, not in design time.
Stephen Wrighton
Stephen, thanka for the input (sorry for the late reply) been manic on my front of late. Care to place this in our own answer so we can discuss, and you can get credit for it?
Rob Cooper