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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:54:00+00:00 2026-05-25T13:54:00+00:00

I am looking for a work around for what seems like a bug in

  • 0

I am looking for a work around for what seems like a bug in WinForms or Win32. I have a method for position a form before it is shown, but when I show it the height of forms with ControlBox set to false is reduced, cutting off some controls.

The steps to reproduce this are to make a form in the designer with ControlBox set to false (removes the close/minimize/maximize buttons) and Text is a non-empty string (the titlebar is not removed) and then in code after creating the form set the Location property to something before calling Show/ShowDialog.

The problem seems to be that the height is being changed to what it would be if Text was empty (no titlebar). If I edit *.designer.cs manually and set the value of ControlBox after setting Text the problem is gone. But manually changing the generated code does not seem practical or good for maintenance.

I’ve tried to set ControlBox to true in code before changing the location, I tried saving the height before setting location (the height returned is the shorter value) and I’ve tried invalidating the form before setting Location to make it pickup the fact that Text is filled out. None of these seem to correct the bad height value. In Reflector my attempts to trace what is going on quickly disappear into public static extern bool SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, int x, int y, int cx, int cy, int flags) after setting some form style values – I assuming some magic happens here to adjust the form size.

// Method is called after dialog is created but before Show() is called
public static void PlaceDialog(Form dialog)
{   
 dialog.Location = new Point(1, 1);    
}

Any ideas on a work around I could use in PlaceDialog to fix this? The only one I’ve found to work so far is very ugly and breaks a number of forms events:

// Method is called after dialog is created but before Show() is called
public static void PlaceDialog(Form dialog)
{ 
 if (dialog.ControlBox == false)
 {
   dialog.ControlBox = true;
   dialog.Show();
   dialog.ControlBox = false;
   dialog.Hide();
 }  
 dialog.Location = new Point(1, 1);    
}
  • 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-25T13:54:01+00:00Added an answer on May 25, 2026 at 1:54 pm

    Try changing or adding the following:

    dialog.FormBorderStyle = FormBorderStyle.None;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to work out the bug on this but can't seem
Looking for a proven to work algorithm for production. Did see this example but
The company I work for is looking to implement a caching solution. We have
I need to detect IE6 in order to work around the lack of position:fixed.
Im learning a lot about how MVC frameworks work by looking around and studying
I have been around and around with this. Have seen similar questions here but
Recently I have been looking at jquery/javascript solutions to emulating the placeholder attribute, but
I have been looking around for a good Android AR toolkit to play with.
I did some research and looking around and it seems the way to do
I work a lot with decision makers looking to use technology better in their

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.