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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:04:08+00:00 2026-05-23T13:04:08+00:00

Edit: Assume a TextBox as the control for the example – where height is

  • 0

Edit: Assume a TextBox as the control for the example – where height is not an issue

So I am using the mouse to change a control’s width and location at runtime (through grabbing a handle with a mouse, much the same way that you can change it at design time). However, I am noticing some resizing issues, which I thought would be fixed by calling

<panel>.SuspendLayout
<control>.location = new Point(x, y)
<control>.width = newWidth
<panel>.ResumeLayout

Now both the location and width change correctly, but because the location changes first – you see a blur of the textbox changing width after it moves. Now reading through Suspend and ResumeLayout, I guess they are supposed to be called before the controls are constructed. With that being the case: how do I make sure the location and width change at once to avoid the blur?

Edit: Solved – The following code allowed me to suspend drawing the control before the properties were set, then resume afterward. As opposed to suspending the layout*

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Integer, _
                                                                ByVal wMsg As Integer, _
                                                                ByVal wParam As Integer,
                                                                ByVal lParam As Integer) As Integer

Private Const WM_SETREDRAW As Integer = 11

' Extension methods for Control
<Extension()>
Public Sub ResumeDrawing(ByVal Target As Control, ByVal Redraw As Boolean)
  SendMessage(Target.Handle, WM_SETREDRAW, 1, 0)
  If Redraw Then
    Target.Refresh()
  End If
End Sub

<Extension()>
Public Sub SuspendDrawing(ByVal Target As Control)
  SendMessage(Target.Handle, WM_SETREDRAW, 0, 0)
End Sub

<Extension()>
Public Sub ResumeDrawing(ByVal Target As Control)
  ResumeDrawing(Target, True)
End Sub
  • 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-23T13:04:08+00:00Added an answer on May 23, 2026 at 1:04 pm

    Instead of panel.SuspendLayout(), do this.SuspendLayout(). Suspend and Resume are guaranteed to traverse down the actual object tree, but I’ve never had luck with it trickling down the container tree.

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

Sidebar

Related Questions

Edit: Let us assume the classes actually do not share an interface! Major slip
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
i have a asp:TextBox control on the page. i'm setting it to a TextMode=MultiLine,
Edit: This question was written in 2008, which was like 3 internet ages ago.
Edit: From another question I provided an answer that has links to a lot
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
EDIT What small things which are too easy to overlook do I need to
Edit : Solved, there was a trigger with a loop on the table (read
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know

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.