Question

I have a form that is being used as a data entry wizard. It hosts a series of panels, and each of the panels docks to fill the display area. I've been working with the display using VS 2010, and then VS 2012 RC, for some time with no issues.

However, I recently installed VS 2012 RTM and came across this strange issue: when running the application using F5 from within the IDE, the form displayed by App.vshost.exe is several pixels too narrow and is goofing up the display of the docked panel in the wizard. When running App.exe directly (via Ctrl-F5 in the IDE or running the .exe directly), the form is the correct size. The same issue occurs both with Debug and Release configurations.

I tested the code in VS 2010 and both App.vshost.exe and App.exe are displaying identically for this particular wizard & page.

I've narrowed it down to displaying a form as a dialog, where the form displayed has its FormBorderStyle set to FixedSingle. Example:

    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SubForm subForm = new SubForm();
            subForm.ShowDialog(this);
        }
    }

    public partial class SubForm : Form
    {
        public SubForm()
        {
            InitializeComponent();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
        }
    }

In the above example, the size the displayed SubForm differs depending on whether you're running App.vshost.exe or App.exe. (In my actual code, the form border style is set as part of the .Designer.cs file of a base form.)

Does anyone have an idea as to why the compiled App.vshost.exe would be displaying differently? Better yet, does anyone know how I might tweak VS 2012 so that I can trust the display output by App.vshost.exe? Thanks!

No correct solution

OTHER TIPS

So, it turns out it is/was a bug in Visual Studio 2012. Recommended workaround is to disable the Visual Studio hosting process.

Bug track: http://connect.microsoft.com/VisualStudio/feedback/details/759413/winform-dialogs-displayed-differently-by-vshost-exe-and-exe-using-vs-2012-when-formborderstyle-set-in-form-codebehind

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top