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

📄 unit1.pas

📁 107215805Delphi中MapX连接SQLServer
💻 PAS
字号:
//MapInfo China
//James Liu
//20030/4/1

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtrls, MapXLib_TLB, StdCtrls, DB, DBTables;

type
  TForm1 = class(TForm)
    Map1: TMap;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Database1: TDatabase;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
begin
        //application.Destroy ;
        application.Terminate;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
 LayerInfoObject: CMapXLayerInfo;
begin
 LayerInfoObject := CoLayerInfo.Create;
 LayerInfoObject.Type_ := miLayerInfoTypeServer;

 // LayerInfoObject.AddParameter('FileSpec', 'c:\Program Files\MapInfo\MapX 5.0\Maps\worldcap.tab');

 LayerInfoObject.AddParameter('Name', 'SpatialLayer');
 LayerInfoObject.AddParameter('ConnectString','DSN=spatialsqlserver');   //必须参数
 //LayerInfoObject.AddParameter('ConnectString','DSN=spatialsqlserver;UID=James;WSID=LIUYI;DATABASE=sqlserver2000;Trusted_Connection=Yes');
 LayerInfoObject.AddParameter('Query','SELECT * FROM ASIACAPS');
 LayerInfoObject.AddParameter('ToolKit','ODBC');
 Map1.Layers.Add(LayerInfoObject, EmptyParam);
 
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
        Map1.CurrentTool := miZoomInTool ;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
        Map1.CurrentTool := miZoomOutTool; 
end;

end.

⌨️ 快捷键说明

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