I have created my stylus preferences as shown in the screen
But when I go to click the button to format the code it formats it for me like this
Anyone know the reason?
As for how to modify whether the c# brackets wrap or not, you could modify the result you want in Tools->Options->C#->Code Style->Formationg->new lines.
By the way, what software are you using. Did your modification have any impact on your expectations?
Related
I would like to be able to set the icon of a project/application in VS programmatically. NOTE: I know how to do this for individual forms, but I would like to do it for the actual application itself, i.e. the icon that the .exe has (and the one that will show in Uninstall Programs and Files..etc).
You can do this in My Project, but I can't seem to find any way to do this via code?
I know how to use Build Configurations and Custom constants etc and I assume the answer would use something like that?
Thanks for any and all assistance with this!
I wrote my first C# program a while ago. It got somewhat big. My .settings file has over 20 different parameters - booleans, sizes, strings, ints. I'd like to provide users with a GUI to change them during runtime instead of editing the app.exe.config file which is somewhat advanced and confusing.
I'm very inexperienced with C# but seems like there should be a better way than for me to manually create a form, drag in labels, inputs, checkboxes, radio buttons, and manually handle all gui events and what happens when values get changed and whatnot. Building this gui by hand seems like a lot of work.
How do you guys handle the settings of a C# app? Can't I generate something from the XML?
In WinForms applications you can add a control to a Form and then click the (PropertyBinding) under (ApplicationSettings) in the Property box.
The dialog allows you to bind properties of the control to a parameter in the config file. It is an extra step during design but it must be done.
These settings will end up in the user config file (I strongly advise against the application config file for this)
You will have to provide the user with a way to specify these settings by either:
having the user edit the config file - very dangerous because it is very easy to mess that up.
allowing the user to manipulate the UI (drag-drop) and save the settings from code. - a lot of work to prevent the user painting himself in a corner.
a separate/standalone designer application that combines 1. and 2.
In WPF you can use DataGrid or ListView for your task. However, if you are inexperienced with C# or WPF, it is maybe faster to do the settings form by hand.
Is it possible to make C# code editor in VS2010 only highlight word references when a word is doubleclicked, like e.g. MetalScroll, not always whenever the cursor is on a word?
Maybe there are some extensions that could do it? Is it even possible to affect this area of VS with an extension?
http://blogs.msdn.com/b/zainnab/archive/2010/04/14/the-best-of-visual-studio-2010-how-to-use-reference-highlighting.aspx
You could maybe use the information here to write a macro to enable/disable highlighting on demand (though it won't work on a double click)
In Visual Studio 2010, if you hover your mouse over the little [-] minus sign, it will highlight that block of code for you. My question is, is there a way for this block to always be highlighted while you are coding inside of it? That way, as I'm hopping between methods and classes, whatever block I'm currently working on would be highlighted to help my eyes quickly focus.
Is there an option within Visual Studio for this? If not, are there any plugins that do this?
Resharper has some options for this, one will let you outline the braces you are currently in and I think the other lets you highlight the current line
ReSharper is nice, but if you're also looking for something for all kinds of languages, there is Visual Assist X, which also does nice highlighting.
It, too, has the option to highlight matching braces in your current block:
Then you have a line highlighter, either as a simple frame:
Or as a good looking background:
Sadly, there is no option in it to enable a real "block" highlighting like hovering over the [-] button does. :| I also looked for, but didn't find such an option within the Visual Studio options.
Highlight everything you want your eyes to focus on and press ctrl+H.
Or, highlight everything you DON"T want and right click "Outlining" then select "Hide Selection." The short cut for that is ctrl+M
This can be done using bookmarks. The out-of-the-box configuration of bookmarks does not highlight, however this can be changed easily:
Go to Tools – Options – Environment – Fonts and Colors. Under Display Items, select Bookmark. Now change the background color to something, like red. Then go to Tools – Options – Text Editor – General and uncheck Indicator Margin.
PS Bookmarks can be found in the Text Editor toolbar
PS2: To quickly set bookmarks use Ctrl+k+k, but beware of Ctrl+k+l which will wipe out all your bookmarks, it happened to me once!
Adapted from: http://blogs.msdn.com/b/saraford/archive/2007/09/05/did-you-know-how-to-change-a-bookmark-color.aspx
i want to ask abt Sharpdevelop.
Can i change the control's event name in sharpdevelop ? I want to add "_" like in visual studio.
For Example, button click event in Sharp develop defaulted to Button1Click. can i change to Button1_Click like in visualstudio ?
Thanks.
Mike Webb's answer is the only way to generate an event handler method name with an underscore without modifying SharpDevelop's source code.
Lex Li's answer is also correct. There is no option in SharpDevelop to enable automatic generation of event handler method names that use an underscore. The only way currently is to modify the source code. It is a fairly straightforward code change.
Download the source for SharpDevelop.
Extract the code.
Locate the EventBindingService class (src\AddIns\DisplayBindings\FormsDesigner\Project\Src\Services\EventBindingService.cs)
Locate the CreateUniqueMethodName method.
Modify the single line of code in this method to use an underscore in the string format:
return String.Format("{0}_{1}", Char.ToUpper(component.Site.Name[0]) + component.Site.Name.Substring(1), e.DisplayName);
Build SharpDevelop from source code by running src\DebugBuild.bat or src\ReleaseBuild.bat
Then when you use your customised version of SharpDevelop and double click a button in the forms designer, for example, you will get an event handler with a name like "Button1_Click".
At some point in the future SharpDevelop 4 will allow this with an option that can be selected in Tools - Options.
Yes. If you go into design and look in the properties window for the control you will see a few icons at the top. One of these should give you the list of events (in VS it is a lightning bolt). In the left hand column are the linkable events and in the right hand column are the functions that are called when the events are triggered.
Simply rename the left hand field and make sure you have the function named correctly in code as well. You can also type a name into the left hand field and then double click inside it to generate the function automatically.
The underscore is evil to some people, like me :)
Well, if you do want the underscore, check out SharpDevelop source code and locate that part and modify it. It is open source, so you can do whatever you like to please yourself. I did not see a setting available somewhere, so modify the source code seems to be the only way to achieve your goal.
I know this is an old thread but in SharpDevelop v4.3 (v4.x - v5.x) there is a solution to this. In the past i've had to use the above method, however this one is much faster and easier.
Launch SharpDevelop and check the following setting:
Tools > Options > Windows Forms Designer > General > "Generate Visual Studio Style Event Handlers"