Hi folks,
I have a form in which I'm starting a separate thread (which is searching
directories for image-files and generating thumbnails of them in different
dir). Within the form, I also have a FileSystemWatcher, which will trigger
as soon as a thumbnail is generated from that thread. When triggered, the
thumbnail-image that has just been found is to be displayed in a
"Panel-UserControl" (consisting of a panel and a couple of other controls).
The Panel-UserControl itself will add one Item-UserControl (consisting of a
picturebox and a couple of other controls) for each thumbnail to be
displayed - and that's where everything goes boom:
The FSW's creation-trigger (have tried the trigger-function residing both
in the form and the Panel-UserControl) will call the Panel-UserControl's
AddThumbnail-function which in turn will create a new Item-UserControl in
which that image is to be displayed. But as soon as I'm issuing a
"Panel.Controls.Add ItemControl" or a "ItemControl.Parent=PanelControl",
I'll get the exception ~"controls created on one thread cannot be parented
to another thread".
If it's just not possible (at least I didn't find any hints searching the
web) how would I start a scenario where:
- the main thread includes a thumbnail-listbox (i.e. a user-control that
shows the thumbnails)
- a separate thread creates thumbnails from files within a set of
directories
- after a thumbnail-file has been created, it is to be added to the
thumbnail-listbox
I've been trying this for over a week now so any help will be greatly
appreciated ...
TIA & Cheers,
Olaf