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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:32:58+00:00 2026-05-31T20:32:58+00:00

Yesterday I found out that when you need to create controls at runtime, you

  • 0

Yesterday I found out that when you need to create controls at runtime, you can use the LauyoutEngine to place the controls at the right location. I always used the TableLayoutPanel for this, but I must say, the LayoutEngine works better and I have more control now.

But I was wondering, how does this work under the hood? When is the LayoutEngine property invoked? And when is it a best practice to use the layout engine?

  • 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-31T20:32:59+00:00Added an answer on May 31, 2026 at 8:32 pm

    The LayoutEngine property is accessed/created (and cached!) in the (base) constructor of the Control. So if you want to use it, you need to subclass Control or Panel and override LayoutEngine.

    Try to avoid it. Your UI component:

    • is fairly simple ? Don’t use it, you’ll shoot yourself in the foot.
    • is getting more complex ? Try to solve it by compositing multiple panels, they get you quite far.
    • might be re-used somewhere else ? Try not to use it, you won’t get all the different layout use-cases right (Padding/Margin/DockStyle/DockPadding/Anchors/AutoSize/AutoScroll/…) and it’ll be a mess.

    Maybe, if your UI component

    • is a composed out of more inner controls
    • you’re trying to do something fancy and need more control
    • none of the inner controls should be accissible/extended
    • you’re willing to spend more time than figuring out why your TableLayoutPanel/FlowLayoutPanel/… doesn’t layout the way you want it to

    … then by all means, give it a shot! You could get some quick results, but you’ll find yourself rewriting the layout method more than you’d like.

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

Sidebar

Related Questions

I asked a question about different testing frameworks yesterday. This question can be found
Thanks to StackOverflow I found out yesterday how to add a custom action to
Yesterday I found that I needed to add self to an object as it
Yesterday I found this function: function clone(obj) { return typeof obj === 'undefined' ?
Yesterday, I found myself writing code like this: SomeStruct getSomeStruct() { SomeStruct input; cin
I learned something about DLL's yesterday. But I haven't found the way how to
Yesterday I found myself needing to zoom my Visual Studio text editor and was
This is a expansion on to a previous question that got answered yesterday, which
Yesterday I found source codes for my Tetris game developed many years ago in
Yesterday I found something very strange (I think). It looks like Form.TransparencyKey gives different

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.