Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8497429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:07:25+00:00 2026-06-11T00:07:25+00:00

I’ve recently been adding custom features to some of the various WinForms Controls by

  • 0

I’ve recently been adding custom features to some of the various WinForms Controls by creating custom Component derived classes which just wrap the Control, hooking into the needed events to perform the extra functionality.

For instance, I wanted to add drag-and-drop functionality to a few different ListBox controls in my application, so I created a DragAndDropListBoxComponent which inherits from the Component class, then add this new component to the Forms I needed to add the functionality to, setting the DragAndDropListBoxComponent‘s ListBox property to the list box I wanted to add the functionality to.

I like this method of extending standard Control functionality because I can create more than one custom behavior type of Component for the same Control and mix them together for some interesting effects. This also favors the Composition over Inheritance principle.

It seems to have taken me awhile to come to the realization of using Component class list this. This is partly due to never seeing it used in such a way online – hence my question. Are custom Component classes commonly used in this way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:07:26+00:00Added an answer on June 11, 2026 at 12:07 am

    There are other options, which one you pick doesn’t matter all that much as long as it achieves the desired result and you do not have the feeling your solution is working against you at every turn.

    A possible alternative is using an Extender Provider. One advantage of the Extender Provider is that you seemingly add an “AllowDragAndDrop” property to each Control. (in your case the property would be added only to ListBox instances)
    This new property is visible at Design Time so other consumers don’t have to know the implementation nor location details of the DragAndDrop functionality, they only have to set a property in the PropertyGrid.

    Another possible alternative is using the Decorator pattern. This is for example used in .NET streams: You have a stream and then you add additional behavior (buffering, (un)zipping, encryption, …) by creating a new stream that takes the old one as a constructor parameter. In your case you would wrap a ListBox in a DragAndDropListBox. Be careful though, this approach might cause your more trouble than advantages in this particular case.

    Yet another possible alternative is inheriting from the controls you want to extend and add a list of “CustomBehaviors” to the controls. CustomBehaviors would implement some interface which allows you to add new behavior to the control by adding a concrete instance of the interface to the collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.