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

The Archive Base Latest Questions

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

I have written code that will resize a Control and all of its controls,

  • 0

I have written code that will resize a Control and all of its controls, but there’s a problem with the PropertyGrid. The user interface is a GroupBox that contains the TabControl tabContAll. In tabContAll is a TabPage that contains a PropertyGrid.

private void ResizeUI () 
{
    ui.Location = new Point (this.ClientRectangle.Left, this.ClientRectangle.Top + menubar.Height);
    ui.Size = new Size (this.ClientRectangle.Width, this.ClientRectangle.Height - menubar.Height);
    ResizeControl (tabContAll, ui);
}

private void ResizeControl (Control control, Control parent) 
{
    control.Location = new Point (parent.ClientRectangle.Left, parent.ClientRectangle.Top);
    control.Size = new Size (parent.ClientRectangle.Width, parent.ClientRectangle.Height);

    foreach (Control child in control.Controls) {
        ResizeControl (child, control);
    }
}

This function is called when the form loads, and this is what it looks like compared to if I commented out the resizing in the loop so the PropertyGrid doesn’t get resized:

enter image description here

enter image description here

Furthermore when it is resized, the description doesn’t work. It just shows the name of the property.

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

    I strongly recommend you to not write code for controls resizing unless you need a very very custom behaviour.

    Set Control.Dock or Control.Anchor properties instead, and leave the rest to them.

    For example, your case can be solved easily by setting the Dock property to DockStyle.Fill for both your TabControl and PropertyGrid (and obviously removing the custom resizing methods).

    Here’s a complete MSDN Walkthrough for WinForms custom controls design:

    http://msdn.microsoft.com/en-us/library/6hws6h2t.aspx

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

Sidebar

Related Questions

I have written some PHP code that will return a value if there are
I have written code that opens 16 figures at once. Currently, they all open
I have written some code to ensure that items on an order are all
I have a code written in VB.Net that will run on multiple systems. One
I have written some code in java that will guess a number based on
To dynamically fill DropDown controls on my HTML Form, I have written code that
Hi I have written a code that i will put just a part of
I have written some code in Java that will decode a SHOUTcast stream and
I have written a code in java using swing.So that i will have a
I have written a code in java using swing, so that I will have

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.