|
C#原始碼美化效果演示 |
|
|
|
|
|
SourceFormatX 使用強大的C#詞法解析引擎全面地分析您的原始碼並根據用戶自定義的C#語言程式碼風格重構和美化C#原始碼檔案,因此它能精細地根據不同的原始碼風格美化多種原始碼,甚至是下面這些極度混亂的原始碼:
|
C#原始碼美化範例:
範例1
|
範例2
|
範例3
|
範例4
這是一個非常極端的 C# 原始碼美化的範例,其目的是為了展示 SourceFormatX C# 程式碼美化工具 詞法解析引擎的威力。這份混亂到無法閱讀的C#原始碼檔案在1秒種內即被 SourceFormatX 美化和縮排成整潔且可讀性強的美觀風格樣式。
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();
}
}
}
範例1
|
範例2
|
範例3
|
範例4
|