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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:58:01+00:00 2026-05-21T10:58:01+00:00

Say I have a Form which we’ll call it ParentForm , and it contains

  • 0

Say I have a Form which we’ll call it ParentForm, and it contains a Panel which we’ll call ContainerPanel. Now, ContainerPanel contains a Panel, which we’ll call EntityPanel.

So basically, the Form contains A Panel which contains a Panel.

In ContainerPanel, we have:

void EntityPanel_MouseDown(object sender, MouseEventArgs e)
{
  ContainerPanel.Controls.Remove(EntityPanel);
  ParentForm.AcceptEntityPanel(EntityPanel);
}

and in MainForm, we have:

void AcceptEntityPanel(Panel panel)
{
  Controls.Add(panel);
  panel.MouseUp += new MouseEventHandler(
    delegate(object sender, MouseEventArgs e)
    {
      MessageBox.Show("Mouse has been released.");
    });
}

Note: This is example code only, which I have just typed in here without verifying syntax, etc. I realise it is trivial to combine these two functions into one, however in my application these two functions do several other things and should be separate.

So the EntityPanel, which belongs to ContainerPanel needs to be transferred to ParentForm when the user presses the mouse down.

When the user releases the mouse, I still need the MouseUp event to be triggered, but it is not working.

Previously, I was passing information about the panel and creating a new panel on the parent form, and manually calling the MouseDown method.

What I’m doing now, as you can see in my above example, is that I’m passing the exact same panel back to the parent form. I had hoped that this way the MouseDown/MouseUp would work, however it didn’t.

I’m running out of ideas on how else to structure this module of my program.
Any ideas?

  • 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-05-21T10:58:02+00:00Added an answer on May 21, 2026 at 10:58 am

    This works for me:

     void Form1_Load(object sender, EventArgs e)
     {
        var innerPanel = new Panel();
        outerPanel.Controls.Add(innerPanel);
    
        innerPanel.MouseDown += (a,b) => 
         { 
           outerPanel.Controls.Remove(innerPanel);
           Controls.Add(innerPanel);
           innerPanel.MouseUp += (x,y) => MessageBox.Show("!");
         };
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a form from a remote area http://example.com/form.php which contains: <form
Say I have a form that contains a drop-down list populated by values stored
So let's say I have a form which is being sent somewhere strange (and
Say I have a form that allows users to upload multiple images, which are
So, I have a form (which is basically a UITableView), and once I finish
Let's say I have a schema in which an apple crate contains zero or
Say, I have got a form which uses the same values as my other
I have a form which contains several standard controls (textbox's, buttons, etc). I want
Background Let's say I have millions of interconnected Node instances which together form a
Lets say i have a form which have the following : Name:TextBox Email:TextBox Age:TextBox

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.