翻译vb到delphi,哪位精通这两门最好懂MO的来翻译下解决办法
翻译vb到delphi,哪位精通这两门最好懂MO的来翻译下
Dim Str1 As String
Dim P1 As MapObjects2.Point
Dim Fx As Single,Fy As Single
Fx=Me.scaleX(X,vbTwips,Me.scaleMode)
Fy=Me.scaleY(Y,vbTwips,Me.scaleMode)
Set P1 = Map1.ToMapPoint(Fx,FY)
Str1 = "x= "&Format(P1.X, "0.000 ")& ",y= "&Format(P1.Y, "0.000 ")
Label1.Caption = Str1
-----------------------------
小弟能力有限只能靠字面意思翻,运行不了到Format这里就下不去了
Str1 = "x= "&Format(P1.X, "0.000 ")& ",y= "&Format(P1.Y, "0.000 ")
Delphi:
Str1 = Format( 'x=%.3f,y=%.3f ',[P1.X,P1.Y]) ;
------解决方案--------------------
差不多是这样:
var
str1: stringl
p1 : MapObjects2.Point;
Fx : single;
Fy : single;
begin
P1 := Map1.ToMapPoint(Fx,FY);
Str1 := 'x= ' + Format( '%8.3f ', P1.X) + ',y= ' + Format( '%8.3f ', P1.Y);
Label1.Caption := Str1;
end;
------解决方案--------------------
这两句是VB独有的,做度量转换的,从Twips转换为Me.scaleMode指定的度量,要看你的代码中的Me.scaleMode取值是什么。
Dim Str1 As String
Dim P1 As MapObjects2.Point
Dim Fx As Single,Fy As Single
Fx=Me.scaleX(X,vbTwips,Me.scaleMode)
Fy=Me.scaleY(Y,vbTwips,Me.scaleMode)
Set P1 = Map1.ToMapPoint(Fx,FY)
Str1 = "x= "&Format(P1.X, "0.000 ")& ",y= "&Format(P1.Y, "0.000 ")
Label1.Caption = Str1
-----------------------------
小弟能力有限只能靠字面意思翻,运行不了到Format这里就下不去了
Str1 = "x= "&Format(P1.X, "0.000 ")& ",y= "&Format(P1.Y, "0.000 ")
Delphi:
Str1 = Format( 'x=%.3f,y=%.3f ',[P1.X,P1.Y]) ;
------解决方案--------------------
差不多是这样:
var
str1: stringl
p1 : MapObjects2.Point;
Fx : single;
Fy : single;
begin
P1 := Map1.ToMapPoint(Fx,FY);
Str1 := 'x= ' + Format( '%8.3f ', P1.X) + ',y= ' + Format( '%8.3f ', P1.Y);
Label1.Caption := Str1;
end;
------解决方案--------------------
这两句是VB独有的,做度量转换的,从Twips转换为Me.scaleMode指定的度量,要看你的代码中的Me.scaleMode取值是什么。