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 9024531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:02:22+00:00 2026-06-16T06:02:22+00:00

My intention was to write a LabelOrText UserControl that behaves like a Label or

  • 0

My intention was to write a LabelOrText UserControl that behaves like a Label or like a TextField – depending on a mode parameter in its constructor.
The UserControl has a Text Property and it contains a Label and a TextField – but only one of both can be visible at a time.
So in any Application Source I can now replace all the Labels and all the TextFields with my LabelOrText UserControl without changing any source code …
(Of course, not only the Text property is delegated to the visible inner control, also the Font property and the BackColor property and all the other properties are delegated to the visible inner control …)

This works fine, except the DragOver and DragDrop Events don’t work es expected.

–> LabelOrText1.DragDrop += myDDHandler should work like Label1.DragDrop += myDDHandler

–> LabelOrText1.DragOver += myDOHandler should work like Label1.DragOver += myDOHandler

and

–> any DragOver action on the inner Label with the mouse should call the myDOHandler(o, e)

–> any DragDrop action on the inner Label with the mouse should call the myDDHandler(o, e)


so it would be really simple to replace the Label Controls with my LabelOrText UserControl in any Application’s Source Code.


Any Ideas on how to transparently route the Drag-Events from the inner Control through the UserControl will be highly appreciated!

  • 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-16T06:02:24+00:00Added an answer on June 16, 2026 at 6:02 am

    Textbox alone sounds fine, but if you want to handle drag drop in a parent container, just set the DragDrop events of the label,text and self to the parent/self;

    You can do this transparently by wiring up the events in the parent class, and it should be pretty easy.

    in Parent object CTOR or elsewhere

    //psuedocode
    label.DragDrop += parentEvent;  //aggregate object
    text.DragDrop += parentEvent;
    DragDrop += parentEvent;
    

    I did this with a panel, such that anything that was pushed and dragged cause the whole thing to follow your finger/mouse and scroll. Panning.

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

Sidebar

Related Questions

I want to write a function that calls another function with its arguments. See
I would like to write a plugin that just adds resource filter to the
I'm writing a CouchDB sample. My intention is to write a web app using
I want to pass value of i as a parameter for autosuggest. My intention
My intention is to write a graphical query language where users can drag and
I have a C++ class that writes its data out to a binary std::ofstream
I am working my way through some Objective-C code that I did not write
I'm writing an uploader that has to be able to transmit files of any
Ideally I want to be able to write something like: function a( b )
First I'll state my intention: I'm trying to write a parse rule for potentially

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.