|
C# Source Code Formatting Show |
|
| |
|
|
SourceFormatX code formatter bases on powerful syntax parse engines so it can beautify and format source code files with omnifarious styles, even these messy source code examples below:
|
C# Source Code Formatting Examples:
Example 1
|
Example 2
|
Example 3
|
Example 4
This is an extreme C# code formatting example, the purpose of it is to show the power of SourceFormatX C# Code Formatting Tool's syntax parse engine for C# (C Sharp) programming language.
using System;using System.Drawing;using System.Collections;using
System.ComponentModel;using System.Windows.Forms;using System.Data;using
VSNET.Menu;namespace MyDrawMenu{/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1:System.Windows.Forms.Form{private const String BMPPATHSTR=
"C:\\DotNetApp\\VSNETMenu\\Pictures\\";private System.Windows.Forms.Button
button1;private System.ComponentModel.Container components=null;private
System.Windows.Forms.MainMenu MainMenu1;private System.Windows.Forms.MenuItem
mItems1;private System.Windows.Forms.MenuItem mItems2;private
System.Windows.Forms.MenuItem mItemsFile;private System.Windows.Forms.MenuItem
mItemsHelp;protected override void Dispose(bool disposing){if(disposing){if(
components!=null){components.Dispose();}}base.Dispose(disposing);}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent(){this.button1=new System.Windows.Forms.Button
();this.SuspendLayout();this.button1.Location=new System.Drawing.Point(104,168)
;this.button1.Name="button1";this.button1.Size=new System.Drawing.Size(80,24);
this.button1.TabIndex=0;this.button1.Text="Exit";this.button1.Click+=new
System.EventHandler(this.button1_Click);VSNET.Menu.IconMenuStyle MenuStyle=
VSNET.Menu.IconMenuStyle.VSNet;MainMenu1=new MainMenu();mItemsFile=new MenuItem
("&File");mItemsFile.Index=0;mItemsHelp=new MenuItem("&Help");mItemsHelp.Index=
1;IconMenuItem iMenuItem=new IconMenuItem();System.Drawing.Bitmap Bitmap1=new
Bitmap(BMPPATHSTR+"Open.bmp");mItems1=iMenuItem.MenuItemCreator(MenuStyle,
"&Open",Bitmap1,null);Bitmap Bitmap2=new Bitmap(BMPPATHSTR+"Save.bmp");mItems2=
iMenuItem.MenuItemCreator(MenuStyle,"&Exit",Bitmap2,null);
this.mItemsFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]{
this.mItems1,this.mItems2});this.MainMenu1.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[]{this.mItemsFile,this.mItemsHelp});this.Menu=
this.MainMenu1;this.AutoScaleBaseSize=new System.Drawing.Size(6,14);
this.ClientSize=new System.Drawing.Size(292,273);this.Controls.AddRange(new
System.Windows.Forms.Control[]{this.button1});this.Name="Form1";this.Text=
"Form1";this.ResumeLayout(false);}[STAThread]static void Main(){Application.Run
(new Form1());}private void button1_Click(object sender,System.EventArgs e){
this.Close();}}}
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using VSNET.Menu;
namespace MyDrawMenu
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1: System.Windows.Forms.Form
{
private const String BMPPATHSTR = "C:\\DotNetApp\\VSNETMenu\\Pictures\\";
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
private System.Windows.Forms.MainMenu MainMenu1;
private System.Windows.Forms.MenuItem mItems1;
private System.Windows.Forms.MenuItem mItems2;
private System.Windows.Forms.MenuItem mItemsFile;
private System.Windows.Forms.MenuItem mItemsHelp;
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
this.button1.Location = new System.Drawing.Point(104, 168);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 24);
this.button1.TabIndex = 0;
this.button1.Text = "Exit";
this.button1.Click += new System.EventHandler(this.button1_Click);
VSNET.Menu.IconMenuStyle MenuStyle = VSNET.Menu.IconMenuStyle.VSNet;
MainMenu1 = new MainMenu();
mItemsFile = new MenuItem("&File");
mItemsFile.Index = 0;
mItemsHelp = new MenuItem("&Help");
mItemsHelp.Index = 1;
IconMenuItem iMenuItem = new IconMenuItem();
System.Drawing.Bitmap Bitmap1 = new Bitmap(BMPPATHSTR + "Open.bmp");
mItems1 = iMenuItem.MenuItemCreator(MenuStyle, "&Open", Bitmap1, null);
Bitmap Bitmap2 = new Bitmap(BMPPATHSTR + "Save.bmp");
mItems2 = iMenuItem.MenuItemCreator(MenuStyle, "&Exit", Bitmap2, null);
this.mItemsFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]
{
this.mItems1, this.mItems2
}
);
this.MainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]
{
this.mItemsFile, this.mItemsHelp
}
);
this.Menu = this.MainMenu1;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[]
{
this.button1
}
);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
[STAThread] static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
Example 1
|
Example 2
|
Example 3
|
Example 4
Don't waste time on formatting C# source code yourself! Try SourceFormatX C# Code Formatter and let it works for your team.
|