visual studio C# Mysterious change to winform look and feel - c#

I have been creating a simple report application using winforms and crystal in Visual Studio 2010. All was good until one day I opened it up, gave it a run and the entire look and feel changed to the classic windows style. I can't figure out what the heck I did to change this. I have been looking through every setting and property I can find and have not been able find anything. In the picture provided, the top window is what it looks like in my designer, and what it looked like before the change. The bottom picture shows what it looks like now when running.
Any ideas?

It looks like you removed this line:
Application.EnableVisualStyles();
from your Programs.cs file in the Main() method. That's the only way I was able to get that classic look.

Related

Is there any way to NOT get a Designer error when deleting code? (C#, Visual Studio, WinForms)

I'm making a WinForms program for my Diploma final project using C# and Visual Studio.
Sometimes I accidentally double-click a tool and that opens up the main event for the tool, like button_Click. But when I delete that code and check the Designer, it gives me an error message. If I choose to ignore it, all of the Form's formatting is lost and I have to start over (real pain in the a**).
I usually just click the - to minimise the code block and then add comments that the code is unused. But as you can guess, this makes for a really ugly and unorganised coding page.
Is there any way for me to remove the code and not get a Designer error?
Go to the Form.Designer.cs file or F12 on the InitializeComponent() method.
Then on the right margin look for the red dots and delete the events pointed to methods that have been deleted.
Anyone got a quicker way?

C# Winform Control Dimensions Strange Out Of Editor?

I've run into this weird sizing issue for my windows form application when run. Now in the designer the program looks like This1 (can't upload more then 2 links so look in comments). However when I run it from visual studio it looks like This (notice how all the controls are closer together, the picture box is automatically wider and taller & the picturebox in tileset subform is larger).
When built and run outside of Visual Studio from the bin\debug folder, it looks perfectly fine (as it would in Visual Studio like This). However I recently changed the build folder to one with a shorter path and when I now run from there the entire form looks much larger and the picturebox is again scaled in this2 (can't upload more then 2 links so look in comments).
take a look at this similar question.
Did you try to set the dpi awareness in the manifest as in the question above?
Also be sure, you run both (visual studio) and the .exe from
bin/debug as the same user (ex. run as Administrator).
And if it's not to late, consider a change to wpf, it responds much better to the different screens and different resolutions - at least in my opinion and experience.

What's wrong with the VS.net ASP.net designer

I've seen this happen in both VS.net 2012 and VS.net 2015.
Whenever I use a tabcontainer within a web form and put several tabs in it without a width setting, within the VS ide, the designer the screen looks like this:
But if I put a width in the tabcontainer, say 500px, it looks fine.
Now when I run it without the width, the web page looks fine.
I know I should probably just ignore the designer screen but it comes in very handy at design time. Hence why I'm sure they called it "Designer"
Is there a setting I'm missing in VS that will allow the designer to work correctly? Or some code I can put into it?
John

How to display a form inside another form like Visual Studio

How does Visual Studio and other similar programs display a form in their IDE?
Is it possible to achieve the same or a similar effect using C# or VB.NET?
Please see the picture below to get what I mean.
If you are talking about hosting a Winforms editor in your code, it is entirely possible and is actually built in to the .NET framework!
The Essence is the IDesignerHost interface. The whole system is complicated, but can be done (I have done it in production code for runtime layout configuration editing). There is a sample of code from Microsoft here.
I'm sure if you search fir 'IDesignerHost' you'll find enough reference material to figure it out.
Are you speaking about UI creating tools?
Refer to http://www.icsharpcode.net/opensource/sd/ - SharpDevelop for deep dive. It's open sourse, so you'll be able to find out more details.
I believe what you want is a multiple document interface (MDI) see http://msdn.microsoft.com/en-us/library/ms973874.aspx for more info.

How can I create my own form designer?

I'm starting my first C# project, and I want to make a "form designer" (like the one in VS).
The idea is, there will be a visual form designer with a limited toolbox, which will generate Python code (later more) to create the same form.
Problem is, I have no idea how to even get started. First of all, I have the form designer in VS: how do I make a "form-within-a-form?"
Next... I have no idea how complicated this is going to be. I suppose I could just make little boxes appear beside each control created on the form when it is clicked, for resizing, and make a textbox appear on it when double clicked or something, to change the text in it... Things like this.
So another thing I would like to know is this:
I do have programming experience in C and C++, I've done PHP for a number of years and am starting with Python as of recently. I've generated forms dynamically in VB6. Given this experience, am I in way over my head with this project?
this looks like a really good place to start. It has a pretty good example to get you started. You can even download his source (registration required).
It sounds like you're aware it's non-trivial for a C# first-timer. If you keep it pretty simple, it sounds like you're heading in the right direction (although a web-based form designer might be easier).
SharpDevelop would be an example of a full-featured IDE that can be re-purposed, but that's way over the top.
Good luck!
For most people starting out in C#, this project would be too much. With your VB6 background, you may be able to pull it off, though.
Here's a hint: the Visual Studio Windows Forms designer draws controls on its surface - by asking the controls to draw themselves.

Categories

Resources