📄 saltotalotset.pas
字号:
unit saltotalotset;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, Grids, DBGrids, Db, ADODB, StdCtrls, Menus, OleServer, Excel97,
DBCtrls, ImgList, ComCtrls, ToolWin;
type
TFormsaltotalotset = class(TForm)
MainMenu1: TMainMenu;
MenuItem1: TMenuItem;
ExcelApplication1: TExcelApplication;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
DBNavigator1: TDBNavigator;
Panel2: TPanel;
DBGrid1: TDBGrid;
Panel1: TPanel;
Label1: TLabel;
Label20: TLabel;
ImageList1: TImageList;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure DBGrid1KeyPress(Sender: TObject; var Key: Char);
procedure MenuItem1Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBGrid1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
procedure formchangelan;
end;
var
Formsaltotalotset: TFormsaltotalotset;
implementation
uses datamol,salset,publicfunction,main,cvcode;
{$R *.DFM}
procedure TFormsaltotalotset.FormCreate(Sender: TObject);
begin
Datamod.adosaltotalot.Open;
formchangelan;
end;
procedure TFormsaltotalotset.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Datamod.adosaltotalot.close;
end;
procedure TFormsaltotalotset.DBGrid1KeyPress(Sender: TObject;
var Key: Char);
begin
dbgrid_keypress(sender,key);
end;
procedure TFormsaltotalotset.MenuItem1Click(Sender: TObject);
var
RangeE: Excel97.Range;
I, Row: Integer;
Bookmark: TBookmarkStr;
begin
ExcelApplication1.Visible [0] := True;
ExcelApplication1.Workbooks.Add (NULL, 0);
RangeE := ExcelApplication1.ActiveCell;
for I := 0 to DataMod.adosaltotalot.Fields.Count - 1 do
begin
RangeE.Value := DataMod.adosaltotalot.Fields [I].DisplayLabel;
RangeE := RangeE.Next;
end;
DataMod.adosaltotalot.DisableControls;
try
Bookmark := DataMod.adosaltotalot.Bookmark;
try
if DataMod.adosaltotalot.State=dsInactive then
DataMod.adosaltotalot.Open;
DataMod.adosaltotalot.First;
Row := 2;
while not DataMod.adosaltotalot.EOF do
begin
RangeE := ExcelApplication1.Range ['A' + IntToStr (Row),
'A' + IntToStr (Row)];
for I := 0 to DataMod.adosaltotalot.Fields.Count - 1 do
begin
RangeE.Value := DataMod.adosaltotalot.Fields [I].AsString;
RangeE := RangeE.Next;
end;
DataMod.adosaltotalot.Next;
Inc (Row);
end;
finally
DataMod.adosaltotalot.Bookmark := Bookmark;
end;
finally
DataMod.adosaltotalot.EnableControls;
end;
RangeE:=ExcelApplication1.Activecell;
RangeE.AutoFormat(3,NULL,Null,null,null,null,null);
end;
procedure TFormsaltotalotset.ToolButton4Click(Sender: TObject);
begin
close;
end;
procedure TFormsaltotalotset.formchangelan;
var i,j:integer;
begin
if language='Chinese_GB' then
begin
Caption:=BIG5toGB(Caption);
Font.Charset:=GB2312_CHARSET;
for i:=0 to ComponentCount-1 do
begin
if components[i].ClassType=TToolBar then
begin
TToolBar(components[i]).Font.Charset:=GB2312_CHARSET;
for j:=0 to TToolBar(components[i]).ButtonCount-1 do
begin
TToolBar(components[i]).Buttons[j].Caption:=BIG5toGB(TToolBar(components[i]).Buttons[j].Caption);
TToolBar(components[i]).Buttons[j].Hint:=BIG5toGB(TToolBar(components[i]).Buttons[j].Hint);
end;
end;
if components[i].ClassType=TTabSheet then
begin
TTabSheet(components[i]).Font.Charset:=GB2312_CHARSET;
TTabSheet(components[i]).Caption:=BIG5toGB(TTabSheet(components[i]).Caption);
TTabSheet(components[i]).Hint:=BIG5toGB(TTabSheet(components[i]).Hint);
end;
if components[i].ClassType=TButton then
begin
TButton(components[i]).Font.Charset:=GB2312_CHARSET;
TButton(Components[i]).Caption:=BIG5toGB(TButton(Components[i]).Caption);
TButton(Components[i]).Hint:=BIG5toGB(TButton(Components[i]).Hint);
end;
if components[i].ClassType=TRadioButton then
begin
TRadioButton(components[i]).Font.Charset:=GB2312_CHARSET;
TRadioButton(components[i]).Caption:=BIG5toGB(TRadioButton(Components[i]).Caption);
TRadioButton(components[i]).Hint:=BIG5toGB(TRadioButton(Components[i]).Hint);
end;
if components[i].ClassType=TLabel then
begin
TLabel(components[i]).Font.Charset:=GB2312_CHARSET;
TLabel(components[i]).Caption:=BIG5toGB(TLabel(Components[i]).Caption);
TLabel(components[i]).Hint:=BIG5toGB(TLabel(Components[i]).Hint);
end;
if components[i].ClassType=TStaticText then
begin
TStaticText(components[i]).Font.Charset:=GB2312_CHARSET;
TStaticText(Components[i]).Caption:=BIG5toGB(TStaticText(components[i]).Caption);
TStaticText(Components[i]).Hint:=BIG5toGB(TStaticText(components[i]).Hint);
end;
if components[i].ClassType=TGroupBox then
begin
TGroupBox(components[i]).Font.Charset:=GB2312_CHARSET;
TGroupBox(components[i]).Caption:=BIG5toGB(TGroupBox(Components[i]).Caption);
TGroupBox(components[i]).Hint:=BIG5toGB(TGroupBox(Components[i]).Hint);
end;
if components[i].ClassType=TRadioGroup then
begin
TRadioGroup(components[i]).Font.Charset:=GB2312_CHARSET;
TRadioGroup(components[i]).Caption:=BIG5toGB(TRadioGroup(components[i]).Caption);
TRadioGroup(components[i]).Hint:=BIG5toGB(TRadioGroup(components[i]).Hint);
for j:=0 to TRadioGroup(components[i]).Items.Count-1 do
TRadioGroup(components[i]).Items.Strings[j]:=BIG5toGB(TRadioGroup(components[i]).Items.Strings[j]);
end;
if components[i].ClassType=TCheckBox then
begin
TCheckBox(components[i]).Font.Charset:=GB2312_CHARSET;
TCheckBox(components[i]).Caption:=BIG5toGB(TCheckBox(Components[i]).Caption);
TCheckBox(components[i]).Hint:=BIG5toGB(TCheckBox(Components[i]).Hint);
end;
if components[i].ClassType=TCombobox then
begin
TCombobox(components[i]).Font.Charset:=GB2312_CHARSET;
TCombobox(components[i]).Hint:=BIG5toGB(TCombobox(components[i]).Hint);
for j:=0 to TCombobox(components[i]).Items.Count-1 do
TCombobox(components[i]).Items.Strings[j]:=BIG5toGB(TCombobox(components[i]).Items.Strings[j]);
end;
if components[i].ClassType=TDBCombobox then
begin
TDBCombobox(components[i]).Font.Charset:=GB2312_CHARSET;
TDBCombobox(components[i]).Hint:=BIG5toGB(TDBCombobox(components[i]).Hint);
for j:=0 to TDBCombobox(components[i]).Items.Count-1 do
TDBCombobox(components[i]).Items.Strings[j]:=BIG5toGB(TDBCombobox(components[i]).Items.Strings[j]);
end;
if components[i].ClassType=TPanel then
begin
TPanel(components[i]).Font.Charset:=GB2312_CHARSET;
TPanel(components[i]).Caption:=BIG5toGB(TPanel(components[i]).Caption);
TPanel(components[i]).Hint:=BIG5toGB(TPanel(components[i]).Hint);
end;
if components[i].ClassType=TDBCheckBox then
begin
TDBCheckBox(components[i]).Font.Charset:=GB2312_CHARSET;
TDBCheckBox(components[i]).Caption:=BIG5toGB(TDBCheckBox(Components[i]).Caption);
TDBCheckBox(components[i]).Hint:=BIG5toGB(TDBCheckBox(Components[i]).Hint);
end;
if components[i].ClassType=TDBNavigator then
begin
for j:=0 to TDBNavigator(components[i]).Hints.Count-1 do
TDBNavigator(components[i]).Hints[j]:=BIG5toGB(TDBNavigator(Components[i]).Hints[j]);
end;
if Components[i].ClassType=TDBGrid then
begin
TDBGrid(components[i]).Hint:=BIG5toGB(TDBGrid(components[i]).Hint);
for j:=0 to TDBGrid(components[i]).Columns.Count-1 do
TDBGrid(components[i]).Columns[j].Title.Caption:=BIG5toGB(TDBGrid(components[i]).Columns[j].Title.Caption);
end;
end; //for
end; //if
end;
procedure TFormsaltotalotset.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=VK_F1 then
begin
//showmessage('ok!')
//MessageDlg(Key + ' has been pressed', mtInformation, [mbOK], 0);
Application.HelpFile :=Extractfilepath(application.ExeName)+ 'help\pasahelp.hlp';
application.HelpJump('SHM_CONTENTS0053');
end;
end;
procedure TFormsaltotalotset.DBGrid1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=VK_F1 then
begin
//showmessage('ok!')
//MessageDlg(Key + ' has been pressed', mtInformation, [mbOK], 0);
Application.HelpFile :=Extractfilepath(application.ExeName)+ 'help\pasahelp.hlp';
application.HelpJump('SHM_CONTENTS0053');
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -