المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Creating a new user control using decorator pattern



C# Programming
06-18-2010, 11:23 PM
Hello all,

To demonstrate the decorator pattern, many articles gives as an example the ability to extend user controls (e.g. a window) with another ability (e.g. scrollable bar).

I'm trying to use it in winforms and extend the ProgressBar.

I'm building a utility function that copy some files from one network drive to another network drive, and I would like to supply also a progress bar that will show (as accurate as possible) the progress of the copy.

In order to that I want to extend the progress bar with a full amount property, and a sniffing method (supplied by the user, e.g. querying the network adapter), and thus the progress bar would display the size so far divided by the known full amount.

Decorator pattern seems the perfect choice but i can't seems to implement in winforms.

Thanks,
Berlus.