Toolbars in ToolStripContainer don't keep their position - c#

I don't know why this is happening... But, every time I open the designer for a form, the toolbars in the ToolStripContainer move one under the other, instead of being all on the same line (how I left it before).
Is there any fix to this problem?

It is because Visual Studio, by default, adds the Layout Toolbar to the ToolStripContainer.
Visual Studio keeps seperate layouts of the ToolStripContainer for different types of editors. It makes sense since for example, when you are editing a form in the form designer you do not need the Text Editor toolbar. Similarly a Dialog editor toolbar is unnecessary when the text editor is opened. For example, you may try to open an xml file and by default, the Xml Editor Toolbar is added to the container.
Any arrangement made to the container is kept, but seperately. You can manually open close toolbar items to arrange the container however you like.

Related

How to add panel on the left visual studio extension

I am trying to add a panel to visual studio for my extension. I want it to be similar to the server explorer but just be below it. Does anyone know how I can add a blank panel like that just below the server explorer for my extension? I want to display some text on that panel.
You need to create a tool window and then manually position it at the desired place.
See Async Tool Window example to get started.
Also, you can find the guide here: create an extension with a Tool Window.
Just create a new VSIX project and add the tool window Item template. It works like a wpf window, you can modify its xx.xaml file to set the window's appearance. Add a textbox to display some texts or what. You can build and debug it(F5) to start the experimental instance. During debugging, go find your window and open it. Then drag it to left layout and it will display next to the server explorer.
When dragging the window, choose the left layout:
And to make it locates just below the server explorer:
(Sometimes the custom panel is above not below the server explorer)You can change the order by the pin button. Click it twice can help.

MDI Child Form is scaling to the wrong size

I have an old C# winforms project I have support for several years now. In this project there is a main form that is an mdiparent and each other form is a child that fits inside the blank area of the parent. This has never been a problem.
Now I am trying to make modifications to this app again, but I do have a newer version of Visual Studio (2015) than I used to. So there is only ONE child form in this app that is giving me trouble. If I revert all my code, open the project, build, that form will appear/scale correctly. If I revert all my code, open the project, open the UI of the form, build, it will shrink the child to a smaller area inside the parent. It only happens on this ONE form, the rest work fine.
I have tried messing with all forms of autosizing, scaling, window size settings, etc but I think its something in VS that is causing just that one form to auto scale incorrectly and I'm not sure what it is. If I look at the auto generated code and compare it to the other forms it will set AutoScaleBaseSize to (6,15) but other forms are at (5,13). If I do like I mentioned above and revert the code but do NOT open the form, the autogenerated code for that form is (5,13) like the other forms.
What is happening in Visual Studio to change this AutoScaleBaseSize property and how can I find the culprit?

Opening Form (.cs) in Design View in Visual Studio Shows Unsaved Changes Immediately

I have a form in a C# project that behaves oddly when opened in "Design" view. Whenever I open the form in "Design" view, it immediately puts an asterisk (*) beside the name of the form on its tab. If I close it without having made any changes, I am prompted to save the changes. Only one form does this.
If I open the code for the form directly, it does not behave this way. If I open the designer code directly, it does not behave this way.
However, there is one odd sequence that I can replicate:
Open the designer code (shows no asterisk)
Open the form in "Design" view (now both tabs have an asterisk)
a. If I try to close either tab now, I am asked to save changes
b. If I close Visual Studio, I am asked to save changes for both tabs (or all 3 if I had both the designer code and the form code open before opening the form in "Design" view).
Switch to designer code tab. When I do this, the "Undo" button enables and I have the option to undo "Designer Generated Code". BUT, the asterisk goes away at this point for only the designer code tab.
a. If I undo the changes, copy the code, redo the changes, and compare the code, they are identical.
I can now close the designer tab without being asked to save changes. The "Design" view tab still has an asterisk and asks to save changes, though. It also still has the "Undo" button enabled with the option to undo "Designer Generated Code"
How do I stop these phantom (not-actually-) changes from being (not-actually-) made when I open the form in "Design" view?
Note: I have nothing fancy or non-standard about my setup. Single developer on same machine every time, everything saves to VS's default locations, no 3rd party anything of any kind involved with VS.
When you work with form designer it use CodDom to generate code in Designer.cs file.once you open up the designer and designer.cs file. the operation you perform while designing the form UI CodeDome will generate a code in a designer file and it will show the * sign.
To make it Short at the end there is a designer.cs file which will actually reflect the changes in the form designer.

Blend + VS 2012 Ultimate Form Missing in VS

I created a WPF form in Blend and now I want to bring this form into VS2012 so I can start putting code to the buttons, etc. I cannot open projects from VS2012 directly into blend the shortcut to do this isn't there, but I can edit my Blend project in VS2012. When I do this and run the project in VS2012 I see the form as expected which I've created in blend. The problem is in VS I cannot find the actual form anywhere to work with, I can only edit the files themselves. Not sure if I'm doing something silly, but I'm trying to click into buttons to create events like I would normally. Any ideas what I'm missing?
When I open other WPF projects that I started in VS2012 (not blend) the form comes right up for me to interact with.
In VS open the xaml for the form. If you can't see the designer, look at the bottom of the xaml window, there should be some tabs there: XAML, Design and Document Outline. Selected Design will switch your view from the Xaml to the 'Form view' (the designer). If you look on the right there are some buttons for changing the view to a split view, either vertically or horizontally that allow you to see both the Xaml and the design at the same time. You can end up in the state where you don't see the form if you expanded the xaml view to fill the pane.
The horizontal view will look like this:

Label size, panel size changes when I close and open the designer file

This might sound crazy but couldn't figure out why this has been happening.
I'm developing app on windows mobile 6. I use win forms for UI. Consider a form I created in sample1.cs, with some labels and text boxes on panel. And neatly adjust size and location.
When I close the sample.cs designer file from visual studio and reopen it, some how I get different values for lable size or textbox size, or panel size. How many times I ever change, finally if I close and re-open it, all the labels have different size - all formatting is gone :(
Any idea about what has been happening, this is really frustrating... :(
Thanks in advance
On your Form_Show event, add code to set your controls to the size you need them to be.
The easiest way to do this, from withing VS2008, is to have both the GUI and the code windows open, go to the menu up top in VS, and select Window > New Vertical Tab Group. Select one of your controls in the GUI, make note of that control's Size and Location in the Properties window, then write that in the Form_Show event.

Categories

Resources