⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 savenamelist_un.pas

📁 五子棋的课程设计
💻 PAS
字号:
unit saveNameList_Un;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB;

type
  TForm4 = class(TForm)
    ListBox1: TListBox;
    ADOConnection1: TADOConnection;
    procedure FormCreate(Sender: TObject);
    procedure ListBox1DblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form4: TForm4;

implementation

{$R *.dfm}
uses
  Unit1;

procedure TForm4.FormCreate(Sender: TObject);
var
  TableList: TStringList;
  i:integer;
begin
  TableList := TStringList.Create;
  ADOConnection1.GetTableNames(TableList);
  for i := 0 to TableList.Count-1 do
  begin
    if TableList.Strings[i] = 'Users' then
    begin
      continue;
    end
    else
        ListBox1.Items.Add(TableList.Strings[i]);
  end;
end;

procedure TForm4.ListBox1DblClick(Sender: TObject); //文件列表
var
  openName:string;
  openX,openY,openTablecount:integer;
  n:integer;
begin
    Form4.Close;
    n := ListBox1.ItemIndex;
    openName := ListBox1.Items.Strings[n];
    with MainForm do
    begin
      start;
      ADOQuery1.Close;
      ADOQuery1.SQL.Clear;
      ADOQuery1.SQL.Add('select *from '+openName+';');
      ADOQuery1.Open;
      ADOQuery1.RecNo := 1;
      while(ADOQuery1.RecNo <= ADOQuery1.RecordCount) do
      begin
        openX := StrToInt(ADOQuery1.FieldByName('x').Value);
        openY := StrToInt(ADOQuery1.FieldByName('y').Value);
        openTablecount := StrToInt(ADOQuery1.FieldByName('tablecount').Value);
        table[openX,openY] := openTablecount;

        saveX[saveCount]:=openX;
        saveY[saveCount]:=openY;
        saveTable[saveCount]:=openTablecount;
        saveCount := saveCount+1;

        DrawTable;
        if iswin(true) then
        begin
          finish:=true;
          shanshuotimer.Enabled:=true;
          exit;
        end;
        if ADOQuery1.RecNo < ADOQuery1.RecordCount then
        begin
          ADOQuery1.RecNo := ADOQuery1.RecNo + 1;
        end
        else
          break;
      end;
      DrawTable;
      ADOQuery1.Close;
    end; 
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -