SourceFormatX

軟體簡介

主要功能

為什麼要使用

源碼美化演示

整合和插件

界面預覽

常見問題

升級歷史

所獲獎項

用戶評價

許可協議

CodeToHtml

Delphi原始碼美化效果演示

現在購買
下載試用

美化工具功能

SourceFormatX 使用強大的Pascal詞法解析引擎全面地分析您的原始碼並根據用戶自定義的Delphi原始碼風格重構和美化Delphi原始碼檔案,因此它能精細地根據不同的原始碼風格美化多種原始碼,甚至是下面這些極度混亂的原始碼:

C/C++ Java C# Delphi (Pascal)
PHP JSP ASP JavaScript
Visual Basic VB.NET VBScript HTML Components
80x86 ASM 8051 ASM CORBA IDL


這是一個非常極端的 Delphi 原始碼美化的範例,其目的是為了展示 SourceFormatX Delphi程式碼美化工具詞法解析引擎的威力。這份混亂到無法閱讀的 Delphi 原始碼檔案在數秒種之內即被 SourceFormatX 美化和縮排成整潔且可讀性強的美觀風格樣式。

  /* 原始碼美化之前的Delphi/Pascal語言原始碼 */

  unit AutoScale;interface uses Windows,Controls,Forms,Classes,Dialogs;type
  TAutoScale=class(TComponent)privateMatrix:Variant;PW,PH,BCount:Integer;procedure
   GetFormInfo(Form:TForm);public constructor Create(AOwner:TComponent);override;
  procedure Init(Form:TForm);procedure Resize(Form:TForm);published end;var
  AutoScale1:TAutoScale;procedure Register;implementation
  procedure Register;begin RegisterComponents('Uwis',[TAutoScale]);end;
  constructor TAutoScale.Create(AOwner:TComponent);begin inherited; //If statement
  if(AOwner is TForm)then Init(AOwner as TForm)else
  ShowMessage('The owner of TAutoScale is NOT a TForm.');end;
  procedure TAutoScale.Init(Form:TForm);begin BCount:=Form.ControlCount-1;
  Matrix:=VarArrayCreate([0,BCount,0,3], VarInteger);GetFormInfo(Form);end;
  procedure TAutoScale.GetFormInfo(Form:TForm); var I:Integer;RGN:TRect;begin
  for I:=0 to BCount do begin RGN:=Form.Controls[I].BoundsRect;Matrix[I,0]:=RGN.
  Left;Matrix[I,1]:=RGN.Top;Matrix[I,2]:=RGN.Right;Matrix[I,3]:=RGN.Bottom;end;PW
  :=Form.ClientWidth;PH:=Form.ClientHeight;end;procedure TAutoScale.Resize(Form:
  TForm);var L,T,LL,TT,RR,BB,W,H,WW,HH,I:Integer;Fas:Boolean;begin WW:=Form.
  ClientWidth;HH:=Form.ClientHeight;Fas:=Form.AutoScroll;Form.AutoScroll:=False;
  for I:=0 to(Form.ControlCount-1)do begin LL:=((Matrix[I,0]*WW)div PW);TT:=((
  Matrix[I,1]*HH)div PH);RR:=((Matrix[I,2]*WW)div PW);BB:=((Matrix[I,3]*HH)div PH)
  ;L:=LL;T:=TT;W:=RR-LL;H:=BB-TT;SetBounds(Form.Controls[I]);end;end;end.

  /* 原始碼美化之後的Delphi/Pascal語言原始碼 */

  unit AutoScale;

  interface

  uses Windows, Controls, Forms, Classes, Dialogs;

  type
    TAutoScale = class(TComponent)
      privateMatrix: Variant;
      PW, PH, BCount: Integer;
      procedure GetFormInfo(Form: TForm);
    public
      constructor Create(AOwner: TComponent); override;
      procedure Init(Form: TForm);
      procedure Resize(Form: TForm);
    published
    end;
  var
    AutoScale1: TAutoScale;
  procedure Register;

  implementation

  procedure Register;
  begin
    RegisterComponents('Uwis', [TAutoScale]);
  end;

  constructor TAutoScale.Create(AOwner: TComponent);
  begin
    inherited; //If statement
    if (AOwner is TForm) then
      Init(AOwner as TForm)
    else
      ShowMessage('The owner of TAutoScale is NOT a TForm.');
  end;

  procedure TAutoScale.Init(Form: TForm);
  begin
    BCount := Form.ControlCount - 1;
    Matrix := VarArrayCreate([0, BCount, 0, 3], VarInteger);
    GetFormInfo(Form);
  end;

  procedure TAutoScale.GetFormInfo(Form: TForm);
  var
    I: Integer;
    RGN: TRect;
  begin
    for I := 0 to BCount do
    begin
      RGN          := Form.Controls[I].BoundsRect;
      Matrix[I, 0] := RGN.Left;
      Matrix[I, 1] := RGN.Top;
      Matrix[I, 2] := RGN.Right;
      Matrix[I, 3] := RGN.Bottom;
    end;
    PW := Form.ClientWidth;
    PH := Form.ClientHeight;
  end;

  procedure TAutoScale.Resize(Form: TForm);
  var
    L, T, LL, TT, RR, BB, W, H, WW, HH, I: Integer;
    Fas: Boolean;
  begin
    WW := Form.ClientWidth;
    HH := Form.ClientHeight;
    Fas := Form.AutoScroll;
    Form.AutoScroll := false;
    for I := 0 to (Form.ControlCount - 1) do
    begin
      LL := ((Matrix[I, 0] * WW) div PW);
      TT := ((Matrix[I, 1] * HH) div PH);
      RR := ((Matrix[I, 2] * WW) div PW);
      BB := ((Matrix[I, 3] * HH) div PH);
      L  := LL;
      T  := TT;
      W  := RR - LL;
      H  := BB - TT;
      SetBounds(Form.Controls[I]);
    end;
  end;

  end.

  不要再浪費寶貴的時間手動整理美化 Delphi / Pascal 語言原始碼了! 現在就下載SourceFormatX原始碼美化工具