请帮忙翻译VB代码到DELPHI(100分)

  • 主题发起人 主题发起人 luket
  • 开始时间 开始时间
L

luket

Unregistered / Unconfirmed
GUEST, unregistred user!
这是在调用DHTMLEDIT 的SetContextMenu()时要用到的:
Dim strings() As String
Dim states() As OLE_TRISTATE
strings(0) = "Cut"
strings(1) = "Copy"
strings(2) = "Paste"
states(0) = Unchecked
states(1) = checked
states(2) = Gray

DHTMLEdit1.SetContextMenu strings, states
 
type TTriState = (Unchecked,Checked,Gray);
var
states:array[0..2] of TTriState;
strings:array[0..2] of string;
begin
strings(0) = "Cut";
strings(1) = "Copy";
strings(2) = "Paste";
states(0) = Unchecked;
states(1) = checked;
states(2) = Gray


DHTMLEdit1.SetContextMenu(strings, states);
end;
 
我考!刚才直接拷贝,忘了改赋值符号。

strings(0) := "Cut";
strings(1) := "Copy";
strings(2) := "Paste";
states(0) := Unchecked;
states(1) := checked;
states(2) := Gray;
 
仔细一下:
strings(0) := 'Cut';
strings(1) := 'Copy';
strings(2) := 'Paste';
 
再仔细一下:
strings[0]:= "Cut";
strings[1] := "Copy";
strings[2] := "Paste";
states[0] := Unchecked;
states[1] := checked;
states[2] := Gray


我考,这是不是delphi程序员的通病?
 
全部不能编译通过!!
请注意:SetContextMenu(OLEVariant,OLEVariant);参数类型是OLEVariant
 
我这里没有这个控件,所以无法调试,你给我发一个控件,我来试试?
zhuan@263.net
 
http://202.96.70.228/cakk/delphi/ocx_dhtmleditsdk.exe
 
var
strings : array [1..3] of string=('Cut','Copy','Paste')
记得改引号!!!
 
var states,strings:olevariant;

strings:=vararraycreate([0,2],varolestr);
strings[0]:='cut';
......

states:=vararraycreate([0,2],varinteger);
states[0]:=Unchecked;//如果delphi没有自动生成unchecked值,就直接写0;
//0 - Unchecked
//1 - Checked
//2 - Gray
....
 
温柔一刀兄的是对的。

//bow 温柔一刀
 
多人接受答案了。
 
后退
顶部