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

📄 mapformcom_tlb.pas

📁 此代码是关于mapgis的在
💻 PAS
📖 第 1 页 / 共 2 页
字号:
    procedure GoToSubStation(SubStationID: Integer; BoundSeed: Double); dispid 223;
    procedure SetCurrentUnit(UnitID: Integer); dispid 224;
    procedure SetGISPageVisible(Index: Integer; Visible: WordBool); dispid 225;
  end;

// *********************************************************************//
// DispIntf:  IMapFormEvents
// Flags:     (4096) Dispatchable
// GUID:      {5FC0AAC7-CCD6-4EF3-97FA-BD653E2E0B16}
// *********************************************************************//
  IMapFormEvents = dispinterface
    ['{5FC0AAC7-CCD6-4EF3-97FA-BD653E2E0B16}']
    procedure OnActivate; dispid 201;
    procedure OnClick; dispid 202;
    procedure OnCreate; dispid 203;
    procedure OnDblClick; dispid 204;
    procedure OnDestroy; dispid 205;
    procedure OnDeactivate; dispid 206;
    procedure OnKeyPress(var Key: Smallint); dispid 207;
    procedure OnPaint; dispid 208;
  end;


// *********************************************************************//
// OLE Control Proxy class declaration
// Control Name     : TMapForm
// Help String      : MapForm Control
// Default Interface: IMapForm
// Def. Intf. DISP? : No
// Event   Interface: IMapFormEvents
// TypeFlags        : (34) CanCreate Control
// *********************************************************************//
  TMapFormOnKeyPress = procedure(ASender: TObject; var Key: Smallint) of object;

  TMapForm = class(TOleControl)
  private
    FOnActivate: TNotifyEvent;
    FOnClick: TNotifyEvent;
    FOnCreate: TNotifyEvent;
    FOnDblClick: TNotifyEvent;
    FOnDestroy: TNotifyEvent;
    FOnDeactivate: TNotifyEvent;
    FOnKeyPress: TMapFormOnKeyPress;
    FOnPaint: TNotifyEvent;
    FIntf: IMapForm;
    function  GetControlInterface: IMapForm;
  protected
    procedure CreateControl;
    procedure InitControlData; override;
  public
    procedure SetupParent(AHandle: Integer; pAppId: Integer);
    procedure SubStationWarning(SubStationID: Integer; const WarningMessage: WideString; 
                                BoundSeed: Double);
    procedure LoadMapInstance(const Path: WideString);
    procedure UnLoadMapInstance;
    procedure Connect(const UserName: WideString; const Password: WideString);
    function ConnectToDataBase(const Server: WideString; const UserName: WideString; 
                               const Password: WideString): WordBool;
    procedure GoToSubStation(SubStationID: Integer; BoundSeed: Double);
    procedure SetCurrentUnit(UnitID: Integer);
    procedure SetGISPageVisible(Index: Integer; Visible: WordBool);
    property  ControlInterface: IMapForm read GetControlInterface;
    property  DefaultInterface: IMapForm read GetControlInterface;
    property Visible: WordBool index 201 read GetWordBoolProp write SetWordBoolProp;
    property Active: WordBool index 209 read GetWordBoolProp;
    property DropTarget: WordBool index 210 read GetWordBoolProp write SetWordBoolProp;
    property HelpFile: WideString index 211 read GetWideStringProp write SetWideStringProp;
    property ScreenSnap: WordBool index 212 read GetWordBoolProp write SetWordBoolProp;
    property SnapBuffer: Integer index 213 read GetIntegerProp write SetIntegerProp;
    property DoubleBuffered: WordBool index 214 read GetWordBoolProp write SetWordBoolProp;
    property AlignDisabled: WordBool index 215 read GetWordBoolProp;
    property VisibleDockClientCount: Integer index 216 read GetIntegerProp;
    property Enabled: WordBool index -514 read GetWordBoolProp write SetWordBoolProp;
  published
    property Anchors;
    property  ParentColor;
    property  ParentFont;
    property  Align;
    property  DragCursor;
    property  DragMode;
    property  ParentShowHint;
    property  PopupMenu;
    property  ShowHint;
    property  TabOrder;
    property  OnDragDrop;
    property  OnDragOver;
    property  OnEndDrag;
    property  OnEnter;
    property  OnExit;
    property  OnStartDrag;
    property AutoScroll: WordBool index 202 read GetWordBoolProp write SetWordBoolProp stored False;
    property AutoSize: WordBool index 203 read GetWordBoolProp write SetWordBoolProp stored False;
    property AxBorderStyle: TOleEnum index 204 read GetTOleEnumProp write SetTOleEnumProp stored False;
    property Caption: WideString index -518 read GetWideStringProp write SetWideStringProp stored False;
    property Color: TColor index -501 read GetTColorProp write SetTColorProp stored False;
    property Font: TFont index -512 read GetTFontProp write SetTFontProp stored False;
    property KeyPreview: WordBool index 205 read GetWordBoolProp write SetWordBoolProp stored False;
    property PixelsPerInch: Integer index 206 read GetIntegerProp write SetIntegerProp stored False;
    property PrintScale: TOleEnum index 207 read GetTOleEnumProp write SetTOleEnumProp stored False;
    property Scaled: WordBool index 208 read GetWordBoolProp write SetWordBoolProp stored False;
    property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
    property OnClick: TNotifyEvent read FOnClick write FOnClick;
    property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
    property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblClick;
    property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
    property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
    property OnKeyPress: TMapFormOnKeyPress read FOnKeyPress write FOnKeyPress;
    property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;
  end;

procedure Register;

resourcestring
  dtlServerPage = 'Servers';

  dtlOcxPage = 'ActiveX';

implementation

uses ComObj;

procedure TMapForm.InitControlData;
const
  CEventDispIDs: array [0..7] of DWORD = (
    $000000C9, $000000CA, $000000CB, $000000CC, $000000CD, $000000CE,
    $000000CF, $000000D0);
  CTFontIDs: array [0..0] of DWORD = (
    $FFFFFE00);
  CControlData: TControlData2 = (
    ClassID: '{EED7E090-D629-4E66-BF93-CBEBB1DDB97E}';
    EventIID: '{5FC0AAC7-CCD6-4EF3-97FA-BD653E2E0B16}';
    EventCount: 8;
    EventDispIDs: @CEventDispIDs;
    LicenseKey: nil (*HR:$00000000*);
    Flags: $0000001D;
    Version: 401;
    FontCount: 1;
    FontIDs: @CTFontIDs);
begin
  ControlData := @CControlData;
  TControlData2(CControlData).FirstEventOfs := Cardinal(@@FOnActivate) - Cardinal(Self);
end;

procedure TMapForm.CreateControl;

  procedure DoCreate;
  begin
    FIntf := IUnknown(OleObject) as IMapForm;
  end;

begin
  if FIntf = nil then DoCreate;
end;

function TMapForm.GetControlInterface: IMapForm;
begin
  CreateControl;
  Result := FIntf;
end;

procedure TMapForm.SetupParent(AHandle: Integer; pAppId: Integer);
begin
  DefaultInterface.SetupParent(AHandle, pAppId);
end;

procedure TMapForm.SubStationWarning(SubStationID: Integer; const WarningMessage: WideString; 
                                     BoundSeed: Double);
begin
  DefaultInterface.SubStationWarning(SubStationID, WarningMessage, BoundSeed);
end;

procedure TMapForm.LoadMapInstance(const Path: WideString);
begin
  DefaultInterface.LoadMapInstance(Path);
end;

procedure TMapForm.UnLoadMapInstance;
begin
  DefaultInterface.UnLoadMapInstance;
end;

procedure TMapForm.Connect(const UserName: WideString; const Password: WideString);
begin
  DefaultInterface.Connect(UserName, Password);
end;

function TMapForm.ConnectToDataBase(const Server: WideString; const UserName: WideString; 
                                    const Password: WideString): WordBool;
begin
  Result := DefaultInterface.ConnectToDataBase(Server, UserName, Password);
end;

procedure TMapForm.GoToSubStation(SubStationID: Integer; BoundSeed: Double);
begin
  DefaultInterface.GoToSubStation(SubStationID, BoundSeed);
end;

procedure TMapForm.SetCurrentUnit(UnitID: Integer);
begin
  DefaultInterface.SetCurrentUnit(UnitID);
end;

procedure TMapForm.SetGISPageVisible(Index: Integer; Visible: WordBool);
begin
  DefaultInterface.SetGISPageVisible(Index, Visible);
end;

procedure Register;
begin
  RegisterComponents(dtlOcxPage, [TMapForm]);
end;

end.

⌨️ 快捷键说明

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