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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:10:23+00:00 2026-05-25T22:10:23+00:00

Possible Duplicate: “ResizeEnd” equivalent for usercontrols I feel stupid, but I can’t find a

  • 0

Possible Duplicate:
“ResizeEnd” equivalent for usercontrols

I feel stupid, but I can’t find a solution to a problem that I think it’s easy.
I have a user control that (basically) shows an image drawing it during onPaint stage:

protected override void OnPaint(PaintEventArgs e)
{
    if (img != null)
        e.Graphics.DrawImage(img, ...);
}

When user control is resized, it must perform many actions and one is (given a particular condition) resize image to fit width or height, etc…
Image showed can be “heavy”, so when user start resizing and moves mouse, the result is a sort of slow movement that’s not good for end user.
So I’m wondering if there are windows messages reporting me that the resize operation is starting or completed: if so I can stop redrawing when resize starts and repaint image when resize ends.
Thanks to everybody

EDITED:
I tried this:

protected override void WndProc(ref Message m)
{
    const int WM_ENTERSIZEMOVE = 0x0231;
    const int WM_EXITSIZEMOVE = 0x0232;
    switch (m.Msg)
    {
        case WM_ENTERSIZEMOVE: resizing = true; break;
        case WM_EXITSIZEMOVE: resizing = false; break;
    }
}

but those messages are never called 🙁

  • 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-25T22:10:24+00:00Added an answer on May 25, 2026 at 10:10 pm

    I post an answer after a long investigation.
    First of all I want to thank everybody for your contribution, because your suggestions led me to the right way. Thanks to @Hans Passant too, because his solution on this post is an important piece.

    THE PROBLEM:

    • assume we have a usercontrol named innCnt (inner control) contained in another usercontrol named outCnt (outer control), which in turn should be placed in a form we don’t develop (so we can’t edit its source)
    • assume we have to catch the EndResize event in innCnt

    CONTRIBUTES:

    • Using PreProcessMessage or overriding WndProc (thanks to @Cipi):
      I tried these solutions, but I don’t receive WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages from Windows
    • Trap MouseDown and OnResize events (thanks to @Cipi):
      It could be ok, but that logic should be moved on outCnt because innCnt could not receive MouseDown if user is resizing out control or form.
      Anyway I don’t like too much this solution
    • In the Load event of innCnt, hook event handlers to the control’s form’s events (thanks to @hometoast and @pikzen):
      I tried this solution (and the one provided by @Hans here) but this doesn’t work because when innCnt is loaded, even in if not in DesignMode, his parent is a part of outCnt, whose parent is null because not ready set!!

    SOLUTION:
    Basicly I had to move @Hans logic inside outCnt but not in Load event, because even here parent is still null!

    public class OuterControl
    {
        protected override void OnParentChanged(EventArgs e)
        {
            if (!this.DesignMode)
            {
                Form form = this.FindForm();
                if (form != null)
                {
                    form.ResizeBegin += (s, ea) =>innerCnt.Resizing = true;
                    form.ResizeEnd += (s, ea) => innerCnt.Resizing = false;
                }
            }
            base.OnParentChanged(e);
        }
    }
    
    public class InnerControl
    {
        private bool resizing = false;
    
        public bool Resizing { 
            get { return resizing; }; 
            set {
                resizing = value;
                if (!resizing) {
                    // Resizing is just finished:
                    // let's do what we need
                }
            }
        }
    
        protected override void OnResize(EventArgs e)
        {
            if (Resizing)
            {
                base.OnResize(e);
                return;
            }
            else
            {
                // Perform resizing actions
            }
        }
    }
    

    KNOWN PROBLEMS:
    I’m quite sure that if outCnt is placed inside another usercontrol, solution provided won’t work…

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

Sidebar

Related Questions

Possible Duplicate: Why are two different concepts both called “heap”? I've googled around, but
Possible Duplicate: What is the difference between String.Empty and “” Is equivalent to String.Empty
Possible Duplicate: What's wrong with Delphi's “with” I am have a problem debugging code
Possible Duplicate: “main” function in Lua? In Python, you can check if a script
Possible Duplicate: Linq: “Or” equivalent of Where() I posted a question about a week
Possible Duplicate: Python “extend” for a dictionary I know that Python list can be
Possible Duplicate: Are “(function ( ) { } ) ( )” and “(function (
Possible Duplicate: Weird “406 not acceptable” error following code generate a 406 Not Acceptable
Possible Duplicate: ASP.NET “special” tags What is the difference between <%# ... %> ,
Possible Duplicate: When to use “strictfp” keyword in java? What is the use of

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.