电气控制仿真软件

源代码在线查看: unit2.pas

软件大小: 6325 K
上传用户: ywc123456
关键词: 电气控制 仿真软件
下载地址: 免注册下载 普通下载 VIP

相关代码

				unit Unit2;
				
				interface
				
				uses
				  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
				  Db, ExtCtrls, OleCtrls, vgctrl40_TLB, DBTables, StdCtrls, Buttons,
				  DBCtrls, ImgList, ComCtrls, Menus;
				
				type
				  TForm2 = class(TForm)
				    Panel5: TPanel;
				    Panel2: TPanel;
				    SpeedButton7: TSpeedButton;
				    SpeedButton8: TSpeedButton;
				    SpeedButton9: TSpeedButton;
				    SpeedButton10: TSpeedButton;
				    SpeedButton11: TSpeedButton;
				    SpeedButton12: TSpeedButton;
				    SpeedButton13: TSpeedButton;
				    SpeedButton14: TSpeedButton;
				    SpeedButton15: TSpeedButton;
				    SpeedButton16: TSpeedButton;
				    SpeedButton17: TSpeedButton;
				    SpeedButton18: TSpeedButton;
				    SpeedButton19: TSpeedButton;
				    SpeedButton20: TSpeedButton;
				    Panel3: TPanel;
				    ComboBox1: TComboBox;
				    CmWV: TComboBox;
				    MainMenu1: TMainMenu;
				    F1: TMenuItem;
				    X1: TMenuItem;
				    SpeedButton1: TSpeedButton;
				    vgctrl1: Tvgctrl;
				    vgctrl3: Tvgctrl;
				    procedure FormCreate(Sender: TObject);
				    procedure vgctrl1Error(Sender: TObject; const Msg: WideString);
				    procedure SpeedButton6Click(Sender: TObject);
				    procedure SpeedButton13Click(Sender: TObject);
				    procedure SpeedButton7Click(Sender: TObject);
				    procedure SpeedButton12Click(Sender: TObject);
				    procedure SpeedButton8Click(Sender: TObject);
				    procedure SpeedButton10Click(Sender: TObject);
				    procedure SpeedButton9Click(Sender: TObject);
				    procedure SpeedButton11Click(Sender: TObject);
				    procedure SpeedButton14Click(Sender: TObject);
				    procedure SpeedButton15Click(Sender: TObject);
				    procedure SpeedButton16Click(Sender: TObject);
				    procedure SpeedButton17Click(Sender: TObject);
				    procedure SpeedButton18Click(Sender: TObject);
				    procedure ComboBox1Click(Sender: TObject);
				    procedure vgctrl1SelectChange(Sender: TObject);
				    procedure SpeedButton19Click(Sender: TObject);
				    procedure SpeedButton20Click(Sender: TObject);
				    procedure SpeedButton21Click(Sender: TObject);
				    procedure CmWVClick(Sender: TObject);
				    procedure vgctrl1ZoomChange(Sender: TObject; Zoom: Integer);
				    procedure X1Click(Sender: TObject);
				    procedure FormClose(Sender: TObject; var Action: TCloseAction);
				    procedure SpeedButton1Click(Sender: TObject);
				    procedure vgctrl1Message(Sender: TObject; Index: Integer;
				      const Msg: WideString);
				    procedure vgctrl1ModifyChange(Sender: TObject; Modified: WordBool);
				  private
				    procedure CMDialogKey( var Message : TCMDialogKey );message CM_DIALOGKEY;
				  public
				    { Public declarations }
				  end;
				
				implementation
				
				{$R *.DFM}
				procedure TForm2.FormCreate(Sender: TObject);
				var
				  i, n : Integer;
				begin
				  vgctrl1.Design( '' );
				  vgctrl1.ZoomFitWidth();
				  vgctrl3.Run( 'headfoot' );
				  n := vgctrl3.SheetCount;
				  ComboBox1.Items.Clear;
				  for i := 0 to n - 1 do
				    ComboBox1.Items.Add( ISheet( vgctrl3.Sheets[i] ).Name );
				  vgctrl3.Library_ := true;
				  ComboBox1.ItemIndex := 0;
				end;
				
				procedure TForm2.CMDialogKey( var Message : TCMDialogKey );
				begin
				end;
				
				procedure TForm2.vgctrl1Error(Sender: TObject; const Msg: WideString);
				begin
				  ShowMessage( Msg );
				end;
				
				procedure TForm2.SpeedButton6Click(Sender: TObject);
				begin
				  vgctrl1.Print;
				end;
				
				procedure TForm2.SpeedButton13Click(Sender: TObject);
				begin
				  vgctrl1.SaveToFile(vgctrl1.FileName);
				end;
				
				procedure TForm2.SpeedButton7Click(Sender: TObject);
				begin
				  vgctrl1.NewUnit( 'Text', 0 );
				end;
				
				procedure TForm2.SpeedButton12Click(Sender: TObject);
				var
				  Sheet1 : ISheet;
				begin
				  Sheet1 := ISheet( vgctrl1.ActiveSheet );
				  Sheet1.DeleteSelection;
				end;
				
				procedure TForm2.SpeedButton8Click(Sender: TObject);
				begin
				  vgctrl1.Undo;
				end;
				
				procedure TForm2.SpeedButton10Click(Sender: TObject);
				begin
				  vgctrl1.Redo;
				end;
				
				procedure TForm2.SpeedButton9Click(Sender: TObject);
				var
				  Sheet1 : ISheet;
				  Selection : IGroup;
				begin
				  Sheet1 := ISheet( vgctrl1.ActiveSheet );
				  Selection := IGroup( Sheet1.Selection );
				  Selection.CopyToClipboard;
				end;
				
				procedure TForm2.SpeedButton11Click(Sender: TObject);
				begin
				  vgctrl1.Paste;
				end;
				
				procedure TForm2.SpeedButton14Click(Sender: TObject);
				begin
				  vgctrl1.NewTable( 4, 1 );
				end;
				
				procedure TForm2.SpeedButton15Click(Sender: TObject);
				begin
				  vgctrl1.SplitText;
				end;
				
				procedure TForm2.SpeedButton16Click(Sender: TObject);
				begin
				  vgctrl1.MergeText;
				end;
				
				procedure TForm2.SpeedButton17Click(Sender: TObject);
				begin
				  vgctrl1.SetProperty();
				end;
				
				procedure TForm2.SpeedButton18Click(Sender: TObject);
				begin
				  vgctrl1.SetPage();
				end;
				
				procedure TForm2.ComboBox1Click(Sender: TObject);
				begin
				  if ComboBox1.ItemIndex > -1 then
				    vgctrl1.NewUnit( ComboBox1.Items[ComboBox1.ItemIndex], 1 );
				end;
				
				procedure TForm2.vgctrl1SelectChange(Sender: TObject);
				var
				  b : Boolean;
				  Sheet1 : ISheet;
				  Selection : IGroup;
				begin
				  Sheet1 := ISheet( vgctrl1.ActiveSheet );
				  Selection := IGroup( Sheet1.Selection );
				  b := Selection.UnitCount > 0;
				  SpeedButton12.Enabled := b;
				  SpeedButton9.Enabled := b;
				  SpeedButton16.Enabled := b;
				  SpeedButton17.Enabled := b;
				end;
				
				procedure TForm2.SpeedButton19Click(Sender: TObject);
				begin
				  vgctrl1.ZoomIn;
				end;
				
				procedure TForm2.SpeedButton20Click(Sender: TObject);
				begin
				  vgctrl1.Print;
				end;
				
				procedure TForm2.SpeedButton21Click(Sender: TObject);
				begin
				  vgctrl1.MoveSheet;
				end;
				
				procedure TForm2.CmWVClick(Sender: TObject);
				var
				  n, d : Integer;
				  s : AnsiString;
				begin
				  if CmWV.Text = '整页' then
				    vgctrl1.ZoomFit
				  else if( CmWV.Text = '页宽' ) then
				    vgctrl1.ZoomFitWidth
				  else
				  begin
				    s := CmWV.Text;
				    n := Length( s );
				
				    if ( n > 0 ) and ( s[n] = '%' ) then
				      s[n] := #0;
				    try
				      d := StrToInt( s );
				    except
				      MessageBox( Handle, '放大率应在25-500之间.', 0, MB_OK or MB_ICONEXCLAMATION );
				      d := vgctrl1.Zoom;
				    end;
				    if( d < 25 )then
				      d := 25;
				    if( d > 500 )then
				      d := 500;
				    vgctrl1.Zoom := d;
				  end;
				  Windows.SetFocus( vgctrl1.Handle );
				end;
				
				procedure TForm2.vgctrl1ZoomChange(Sender: TObject; Zoom: Integer);
				begin
				  CmWV.Text := IntToStr( Zoom ) + '%';
				end;
				
				procedure TForm2.X1Click(Sender: TObject);
				begin
				  Close;
				end;
				
				procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
				begin
				  Action := caFree;
				end;
				
				procedure TForm2.SpeedButton1Click(Sender: TObject);
				begin
				  Close;
				end;
				
				procedure TForm2.vgctrl1Message(Sender: TObject; Index: Integer;
				  const Msg: WideString);
				begin
				  SpeedButton8.Enabled := vgctrl1.CanUndo;
				  SpeedButton10.Enabled := vgctrl1.CanRedo;
				end;
				
				procedure TForm2.vgctrl1ModifyChange(Sender: TObject; Modified: WordBool);
				begin
				  SpeedButton13.Enabled := Modified;
				end;
				
				end.
							

相关资源