И это печально... Ладно, короче вот Вам рабочий код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, esriCarto_TLB, esriGeometry_TLB, esriDisplay_TLB, esriSystem_TLB,
StdCtrls, ComObj, Spin, esriControls_TLB, OleCtrls;
type
TForm1 = class(TForm, IActiveViewEvents)
MapControl1: TMapControl;
LicenseControl1: TLicenseControl;
procedure FormShow(Sender: TObject);
procedure MapControl1MouseMove(ASender: TObject; button, shift, X,
Y: Integer; mapX, mapY: Double);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
protected
procedure ContentsChanged; safecall;
procedure ContentsCleared; safecall;
procedure ItemAdded(Item: OleVariant); safecall;
procedure ItemDeleted(Item: OleVariant); safecall;
procedure ItemReordered(Item: OleVariant; toIndex: Integer); safecall;
procedure SelectionChanged; safecall;
procedure ViewRefreshed(const view: IActiveView; phase: esriViewDrawPhase; Data: OleVariant;
const envelope: IEnvelope); safecall;
procedure AfterDraw(const Display: IDisplay; phase: esriViewDrawPhase); safecall;
procedure AfterItemDraw(Index: Smallint; const Display: IDisplay; phase: esriDrawPhase); safecall;
procedure FocusMapChanged; safecall;
procedure SpatialReferenceChanged; safecall;
private
pAVe : IInterface;
pHWND : integer;
pPoint : IPoint;
pMarkerSymbol : IMarkerSymbol;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.AfterDraw(const Display: IDisplay; phase: esriViewDrawPhase);
begin
if phase<>32 then exit; //нам нужно только отрисовка "передника"
try
if (ppoint<>nil) then Begin
if pMarkerSymbol<>nil then
Display.SetSymbol(pMarkerSymbol as ISymbol);
Display.Drawpoint(pPoint);
End;
except on E: Exception do Begin
{$I-}
ShowMessage('E_PREF'+'{569FBF7F-A686-491B-A4F6-A4F86CCFE807} '+E.Message);
{$I+}
End;
end;
end;
procedure TForm1.AfterItemDraw(Index: Smallint; const Display: IDisplay;
phase: esriDrawPhase);
begin
end;
procedure TForm1.ContentsChanged;
begin
end;
procedure TForm1.ContentsCleared;
begin
end;
procedure TForm1.FocusMapChanged;
begin
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
InterfaceDisconnect(pAVE,IActiveViewEvents,pHWND);
pAVe := nil;
end;
procedure TForm1.FormShow(Sender: TObject);
var
pColor : IRGBColor;
begin
pPOint:= CoPOint.Create as IPoint;
pMarkerSymbol := CoSimpleMarkerSymbol.Create as IMarkerSymbol;
pColor := CoRGBColor.Create as IRgbColor;
pColor.RGB := RGB(255,0,0);
pMarkerSymbol.Color := pColor as IColor;
pMarkerSymbol.Size :=8;
pAVe := MapControl1.ActiveView as IInterface;
InterfaceConnect(pAVE,IActiveViewEvents,(self as IActiveViewEvents),pHWND);
end;
procedure TForm1.ItemAdded(Item: OleVariant);
begin
end;
procedure TForm1.ItemDeleted(Item: OleVariant);
begin
end;
procedure TForm1.ItemReordered(Item: OleVariant; toIndex: Integer);
begin
end;
procedure TForm1.MapControl1MouseMove(ASender: TObject; button, shift, X,
Y: Integer; mapX, mapY: Double);
begin
if button=1 then Begin
pPoint.PutCoords(mapX,mapY);
MapControl1.ActiveView.PartialRefresh(32,pPoint,nil);
End;
end;
procedure TForm1.SelectionChanged;
begin
end;
procedure TForm1.SpatialReferenceChanged;
begin
end;
procedure TForm1.ViewRefreshed(const view: IActiveView;
phase: esriViewDrawPhase; Data: OleVariant; const envelope: IEnvelope);
begin
end;
end.