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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:44:21+00:00 2026-05-11T17:44:21+00:00

I have created a simple test form with FormBorderStyle = FixedToolWindow by default and

  • 0

I have created a simple test form with FormBorderStyle = FixedToolWindow by default and added a button that will switch between FixedToolWindow and SizableToolWindow on mouse press.

Switching the FormBorderStyle between these two seems to produce a weird effect that’s causing a lot of issues on my application. The problem is that the window seems to change size and I can’t have that. I just want to change the border, I need the form size to remain the same.

For instance, here’s the button code:

private void button1_Click(object sender, System.EventArgs e) {
    if(FormBorderStyle == FormBorderStyle.FixedToolWindow) {
        System.Diagnostics.Debug.WriteLine("SWITCHING: FIXED -> SIZABLE");
        FormBorderStyle = FormBorderStyle.SizableToolWindow;
    } else {
        System.Diagnostics.Debug.WriteLine("SWITCHING: SIZABLE -> FIXED");
        FormBorderStyle = FormBorderStyle.FixedToolWindow;
    }
}

And to debug I use this:

private void Settings_SizeChanged(object sender, System.EventArgs e) {
    System.Diagnostics.Debug.WriteLine(this.Size);
}

And here’s the output when I press the switch button:

SWITCHING: FIXED -> SIZABLE
{Width=373, Height=169}
{Width=383, Height=179}
SWITCHING: SIZABLE -> FIXED
{Width=383, Height=179}
{Width=373, Height=169}

How can I fix this behavior? And by “fix”, I mean, prevent this from happening if possible. I want to be able to specify my form size and to remain like that, no matter the type of border style.

Also, a solution by subclassing the Form class would be the perfect solution for me in case anyone as any ideas to solve this problem with such a method.

EDIT:
I made a little video to demonstrate the problem. The first test shows that the form size doesn’t actually change (visually), only the location of the form changes a little bit; but the values for the Size property do change, as you can see on the debug output. The second test you will see on the debug output that the form Size property values change and the window size itself will also change.

Please look here:
http://screencast.com/t/0vT1vCoyx2u

  • 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-11T17:44:21+00:00Added an answer on May 11, 2026 at 5:44 pm

    Your issue is with the Location changing, not the Size. This code solves the problem seen in the video.

            private void Form1_DoubleClick(object sender, EventArgs e)
            {
                Point _location = this.PointToScreen(this.ClientRectangle.Location);
                if (this.FormBorderStyle == FormBorderStyle.SizableToolWindow)
                {
                    this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                }
                else
                {
                    this.FormBorderStyle = FormBorderStyle.SizableToolWindow;
                }
                Point _newloc = this.PointToScreen(this.ClientRectangle.Location);
                Size _diff = new Size(_newloc) - new Size(_location);
                this.Location -= _diff;
            }
    

    It appears to me that the issue of the rendered form moving when switching between those two borderstyles is a bug in the DWM.

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

Sidebar

Ask A Question

Stats

  • Questions 201k
  • Answers 201k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer To get summary of new/missing files, and which files differ:… May 12, 2026 at 8:07 pm
  • Editorial Team
    Editorial Team added an answer This is a known issue with Google Accounts authentication. If… May 12, 2026 at 8:07 pm
  • Editorial Team
    Editorial Team added an answer Maybe it's a problem with the TextWriter? using (StreamWriter strm… May 12, 2026 at 8:07 pm

Related Questions

The desired functionality of the 'enhanced' combo box is a quick find method. Each
I have a class, which I have simplified to this: final class Thing {
I have been pulling my hair out about this since Friday and I am
I am somewhat new to transactional databases and have come across an issue I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.