字体设置问题 ( 积分: 50 )

靴子

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
MapName: TMap;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure MapNameMouseUp(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
private
point: MapXLib_TLB.Point;
//点
ftr: MapXLib_TLB.Feature;//图元
ssymbol :MapXLib_TLB.style;
procedure creatLayer;
//创建图层
procedure addFont(x , y :do
uble);
//田加图片
{ Private declarations }
public
{ Public declarations }
end;


var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.addFont(x, y:do
uble);
begin

ssymbol.SymbolFontRotation := 80;
point := CoPoint.Create;
point.Set_(X, Y);
MapName.CenterX:= x;
MapName.CenterY:= y;
ftr := MapName.ControlInterface.FeatureFactory.CreateSymbol(point, ssymbol);
MapName.ControlInterface.Layers.Item['temp'].AddFeature(ftr,EmptyParam);
end;


procedure TForm1.creatLayer;
var
lyrLayer :Layer;
begin

MapName.Layers.CreateLayer('temp', EmptyParam,1, EmptyParam, EmptyParam);
MapName.Layers.Item[1].Editable := True;
MapName.Layers.InsertionLayer := MapName.Layers.Item[1];
lyrLayer:=MapName.Layers.Item[1];
lyrLayer.AutoLabel:=true;
lyrlayer.Editable:=true;
end;


procedure TForm1.FormCreate(Sender: TObject);
var
MyFont: TFont;
begin

MapName.GeoSet := ExtractFilePath(paramstr(0))+'workspace/100w.gst';
ssymbol:=costyle.create;
MyFont := TFont.Create;
OleFontToFont(ssymbol.SymbolFont, MyFont);
MyFont.Color := RGB(255, 0, 0);
MyFont.Size := 24;
MyFont.Name := 'mapinfo transportation';
ssymbol.SymbolCharacter := 70;
MyFont.Style := [fsBold, fsUnderline];
creatLayer;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin

addFont(114.471673,38.01934);
end;



这是我的程序,要在地图上显示一个符号,但是我则那么设置MyFont.Name的值都不是我先要的符号样式,好像是默认的一个符号。请高手帮忙。
 
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
MapName: TMap;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure MapNameMouseUp(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
private
point: MapXLib_TLB.Point;
//点
ftr: MapXLib_TLB.Feature;//图元
ssymbol :MapXLib_TLB.style;
procedure creatLayer;
//创建图层
procedure addFont(x , y :do
uble);
//田加图片
{ Private declarations }
public
{ Public declarations }
end;


var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.addFont(x, y:do
uble);
begin

ssymbol.SymbolFontRotation := 80;
point := CoPoint.Create;
point.Set_(X, Y);
MapName.CenterX:= x;
MapName.CenterY:= y;
ftr := MapName.ControlInterface.FeatureFactory.CreateSymbol(point, ssymbol);
MapName.ControlInterface.Layers.Item['temp'].AddFeature(ftr,EmptyParam);
end;


procedure TForm1.creatLayer;
var
lyrLayer :Layer;
begin

MapName.Layers.CreateLayer('temp', EmptyParam,1, EmptyParam, EmptyParam);
MapName.Layers.Item[1].Editable := True;
MapName.Layers.InsertionLayer := MapName.Layers.Item[1];
lyrLayer:=MapName.Layers.Item[1];
lyrLayer.AutoLabel:=true;
lyrlayer.Editable:=true;
end;


procedure TForm1.FormCreate(Sender: TObject);
var
MyFont: TFont;
begin

MapName.GeoSet := ExtractFilePath(paramstr(0))+'workspace/100w.gst';
ssymbol:=costyle.create;
MyFont := TFont.Create;
OleFontToFont(ssymbol.SymbolFont, MyFont);
MyFont.Color := RGB(255, 0, 0);
MyFont.Size := 24;
MyFont.Name := 'mapinfo transportation';
ssymbol.SymbolCharacter := 70;
MyFont.Style := [fsBold, fsUnderline];
creatLayer;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin

addFont(114.471673,38.01934);
end;



这是我的程序,要在地图上显示一个符号,但是我则那么设置MyFont.Name的值都不是我先要的符号样式,好像是默认的一个符号。请高手帮忙。
 
已经解决
 
说说解决方案啊
 
那就把分散了吧。
 
说一下解决案,再散分吧
 
多人接受答案了。
 

Similar threads

顶部